Help - Outputting Thumbnails

Hello PHP Pros -

A novice like myself has one question :

I have a few images users uploaded to a mySQL database. How can I out
them as thumbnails.

Any help would be appreciated.


Thanks !

-n
nickwired [ Mi, 28 Juni 2006 06:15 ] [ ID #1373959 ]

Re: Help - Outputting Thumbnails

as far as i'm aware you can'. Thumbnails were originally designed for
previews on slow 14k dial up connections where you might not want to
wait for the full size image to download.

You can make the image show as a thumbnail by setting the height and
width properties of the <img> tag.

frothpoker
aaron.reese [ Do, 06 Juli 2006 16:39 ] [ ID #1382404 ]

Re: Help - Outputting Thumbnails

aaron.reese [at] tiscali.co.uk wrote:
> as far as i'm aware you can'. Thumbnails were originally designed for
> previews on slow 14k dial up connections where you might not want to
> wait for the full size image to download.

Even with a fast connection I don't think pages with >10 >300k images
charming.

> You can make the image show as a thumbnail by setting the height and
> width properties of the <img> tag.

Which is very bad practise.
Make you images the sizes they should be.
Making them smaller in an HTML page by setting width & height:
- Makes you download an unneccesary large image.
- Makes an ugly image because browser resizing isn't what is could be.
- width & height are originally designed to hint to the browser what the
dimensions are, so the page is rendered correctly before downloading the
images, and doesn't change oncethe images are in.

Make a thumbnail on the fly (or store them) using imagecopyresampled().

Grtz,
--
Rik Wasmus
Rik [ Fr, 07 Juli 2006 15:06 ] [ ID #1383669 ]

Re: Help - Outputting Thumbnails

nickwired wrote:
>
> I have a few images users uploaded to a mySQL database.
> How can I out them as thumbnails.

Get the image from the database and use imagecopyresampled() to reduce
it.

http://www.php.net/imagecopyresampled

Additionally, consider storing thumbnails in the database along with
original images. Generating thumbnails dynamically is expensive in
terms of CPU usage. Many applications generate thumbnails as a part of
image upload procedure.

While you are in the considering mode, consider not storing images in
the database at all. Since not all browsers out there support <img
data="*"> tag, you need a separate script (and, hence, a separate
database connection) to render each image. So a page with five images
on it would create six database connections, which could have dire
performance consequences for a high-traffic Web site.

Cheers,
NC
nc [ Fr, 07 Juli 2006 17:31 ] [ ID #1383671 ]
PHP » alt.php.sql » Help - Outputting Thumbnails

Vorheriges Thema: Selecting 3 database tables at the same time ?? if that makes sense.
Nächstes Thema: Please help me with some SQL