Hi Dear All
I have 1000s of JPGs Images.
Names like S-KHI-1233
Now I need To rename all the images and new name should be last 4 numeric digits like 1233.
For all 1000 JPGs I want to do this.
if image name is S-KHI-1964 then new name should be 1964
and if name S-LAK-1854 then new name should be 1854.
ayesha789 7 Posting Pro in Training
Recommended Answers
Jump to PostUse regular expression:
eg:
$name = 'S-KHI-1233'; $name = preg_replace("/[^0-9]/", '', $name);
Jump to PostBut I have these JPGs in the folder name IMAGES.
How I can apply this code?PHP has numerous ways to traverse directories. Probably the simplest is the glob() function. (PHP4.3+)
…
Jump to PostI have change this according to my path but its not doing any thing as my images are stored in simimage Folder in server.
<? // get an array of all .jpg files $files = glob($_SERVER['DOCUMENT_ROOT']."/simimage/.jpg"); foreach ($files as $filename) { // make sure we have a file …
All 11 Replies
pritaeas 2,211 ¯\_(ツ)_/¯ Moderator Featured Poster
digital-ether 399 Nearly a Posting Virtuoso Team Colleague
ayesha789 7 Posting Pro in Training
muralibobby2015 17 Posting Pro
digital-ether 399 Nearly a Posting Virtuoso Team Colleague
ayesha789 7 Posting Pro in Training
digital-ether 399 Nearly a Posting Virtuoso Team Colleague
ayesha789 7 Posting Pro in Training
ayesha789 7 Posting Pro in Training
digital-ether 399 Nearly a Posting Virtuoso Team Colleague
ayesha789 7 Posting Pro in Training
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.