You are here: Re: create multiple jpg thumbnails and use in a page « PHP « IT news, forums, messages
Re: create multiple jpg thumbnails and use in a page

Posted by Jasper Bryant-Greene on 03/27/05 08:56

Kevin Coyner wrote:
> 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

Without going into too much detail, you just need to use one of the
examples you found on PHP.net to create the thumbnail, and then rather
than calling something like:

imagejpeg('filename.jpg');

once you've created the thumbnail, call this instead:

header('Content-Type: image/jpeg');
imagejpeg();

That will output the jpeg image to the browser. Obviously this would be
in a separate file called from the main script in an img tag, like:

<img src="thumbnail.php?file=some_file_name.jpg" />

A couple of pointers:

1. You'd want to do input checking on the file GET variable to ensure
no-one could get hold of stuff they shouldn't.

2. Make sure you don't output anything else in the file that outputs the
thumbnail, or it won't work.

HTH -- if you need more specifics let me know.

--
Jasper Bryant-Greene
Cabbage Promotions
www: www.cabbage.co.nz
email: jasper@cabbage.co.nz
phone: 021 232 3303

Public Key: Jasper Bryant-Greene <jasper@cabbage.co.nz> keyID 0E6CDFC5
Fingerprint: 2313 5641 F8F6 5606 8844 49C0 1D6B 2924 0E6C DFC5

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация