Reputation: 820
I have a folder with 100's of images in it. I need to resize all the images using imagick
.
for a single image I can run:
exec("/usr/bin/convert images/image-name.jpg -resize 550x413 images/image-name.jpg");
But how would i go about doing the same thing with all the images?
is there any foreach loop function that I could use?
Any help would be appreciated.
Thanks in advance.
Upvotes: 1
Views: 664
Reputation: 3059
You can load all images in array then execute your method in foreach
loop. To load all images in specific array you can use the following command:
$images_array = glob($dir.'*.jpg');
foreach ($images_array as $item) {
//your code goes here
}
Upvotes: 2