what do you think about the following solution:
put your images in a public folder (let's call it images/) and your thumbnails in subdirectories (let's call those small/, medium/ and large/).
Add a 404-handler for the images/ directory that forwards the request to your createThumbnail action.
Now you can include your images like <img src="/images/small/xxx-xxx.jpg" alt="..."/>. If the file exists, your webserver can serve the file directly to the client without even starting a php process. If the file does not exist, the 404 handler will be triggered and you can create the thumbnail on demand.
Particularly on websites with *a lot* of request, you don't want to serve static content through php.
Best regards,
Daniel
Am 13.12.2008 um 19:32 schrieb Raavi Raaj:
Hi,
Performance wise which solution is better for resizing + caching + serving images
All image requests are handled via...
1. Controller + action
2. Dedicated php script outside of the mvc (using htaccess to redirect relevant requests)
I serve images in three sizes small, medium and large and the url for the images look like
1. Small = domain.com/images/s/news-x.xxxxxxxx-xxxx-xxxx.jpg
2. Medium = domain.com/images/m/news-x.xxxxxxxx-xxxx-xxxx.jpg
etc.
All images are stored in the "data/uploads/" folder outside of the public_html folder
I look forward to your suggestions.
Why is performance important?
Cause I am on a shared host with limited server resources :)
Also, if possible could someone share how they handle image serving through a script/mvc
-R
P.S. Some pages have requests to around 30+ images (thumbnails).
没有评论:
发表评论