Lynn Rey
Lynn Rey

Reputation: 231

Php working with Images

I have a php web application which has a gallery.

This gallery uses justified javascript.

Then it uses timthumb.php to resize the images without saving the images in the server.

i would like to know which one would be better..

  1. Loading all the images using timthumb.php

  2. Or saving resized images in the server cache folder and loading all the images from the cache folder.

I have tried these two methods. Strangely 2nd method is slower than first for the first load.

Thank you for all the help.

Lynn

Upvotes: 1

Views: 731

Answers (2)

Ankush Tanwar
Ankush Tanwar

Reputation: 239

Honestly I do not have much idea about timthumb.php.

Although saving the photos in a server cached folder seems to be a better idea, You can save the save the path of the image in your datasource (normally a relational database) , and then while retrieving the photos , extract it from cached folder.

It might be a possibility that your cache is getting reloaded time and again and thats why taking sometime in the first load.

Upvotes: 1

Ralph Ritoch
Ralph Ritoch

Reputation: 3440

Timthumb tends to have security issues and either way image processing requires a great deal of RAM so having cache folders is the best option. Notice that I said folders and not a cache folder. On IIS servers or any windows based server you will run into slowness accessing folders which have more than a few thousand files. Linux is known to have the same problem but not until you have a few hundred thousand files in a folder. Either way, if you're dealing with millions of images it is best to categorize them in some way into separate folders so you don't end up with slowdowns from the OS trying to locate the file.

Upvotes: 2

Related Questions