|
Posted by Mike on 03/26/05 04:49
Here's how I'd go about that -
1) create two pages
a) the page that is displaying the images
b) the script that generates the thumbnails
2) 'a' is simple - it just reads the directory and creates the HTML to
image_thumbnail.php?image=image.jpg
3) 'b' is passed 'image.jpg', reads the file, creates the thumbnail (rather
simple and lots of code in the manual and on the net) and outputs the proper
header info and the right data stream.
4) watch your performance drop and your scripts possibly time out
Simple matter of the fact is that image processing is a dog. It consumes a
lot of resources and has little gain for being done on-the-fly in most
situations. And when you think about it - you're taking a very large amount
of input to output the same exact thing - just smaller. While I know it's
very bad HTML practice, if this is a fast site, you might get faster page
loads by just loading the full image with the image tag set with height and
width constraints ;)
If it's not a heavy/fast site, it might not be a problem. But if it's under
any serious load, pending the image sizes, it might be a big hit.
Just my $.02.
-M
> -----Original Message-----
> From: Kevin Coyner [mailto:kevin@rustybear.com]
> Sent: Friday, March 25, 2005 9:33 PM
> To: php-general@lists.php.net
> Subject: [PHP] create multiple jpg thumbnails and use in a page
>
>
> Is there a way to create multiple jpg thumbnails from a
> series of larger originals and use all of the on-the-fly
> generated thumbnails in a page (without saving any of the
> thumbnails to the filesystem)?
>
> For example, I've got 5 full size jpg's in a directory, and
> I'd like to list them on a page in table form as follows
>
>
> image1.jpg thumnbnail image image1 size datestamp
> image2.jpg thumnbnail image image2 size datestamp
> image3.jpg thumnbnail image image3 size datestamp
> image4.jpg thumnbnail image image4 size datestamp
> image5.jpg thumnbnail image image5 size datestamp
>
> From php.net, I've found plenty of examples of how to create
> thumbnails from files and have done a couple successfully.
> My objective, however, is to have a page dynamically create
> multiple thumbnails from full sized images. I don't want to
> be creating and saving thumbnails to be used later.
>
> Possible? If so, then please just a pointer in the right direction.
>
> Thanks, Kevin
> --
>
> --
> PHP General Mailing List (http://www.php.net/) To
> unsubscribe, visit: http://www.php.net/unsub.php
>
[Back to original message]
|