Create thumbnails of multiple images in one folder at once

Asked

Viewed 235 times

0

Good afternoon guys, I need to create thumbnails of all images contained in a certain folder and save inside a Thumb folder

Ex:

"Photos" folder with multiple JPG images If the Thumb folder does not exist the code should create and save within that folder the thumbnails of the images contained in photos with the same name.

photos/imagem1.jpg <<< normal image photos/Thumb/imagem1.jpg <<< thumbnail

I only found codes that do this resizing while uploading the images, but this is not the case, since the images are already on the server. Could someone help me? Thank you

  • Thanks for the message, but I don’t want to use the GD class because it creates the thumbnail only virtually, I want to create a new image and save in another folder.

  • With GD you can also save to file, not just send to the browser. The link to the first comment includes an example of this in the reply.

  • @Julius could give me an example of how to do this by taking all the images from a folder? In the example you have there you only use 1 image. In case I need to reduce 200, 300 images.

  • @Fredericomoreira Cara unfortunately, I won’t have time now to write a more complete answer, but you can use the functions opendir and readdir to get a list of all the files in a folder and run the above code for each one.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.