Page 1 of 1

[SOLVED] auto thumb image from a blob problem

Posted: Mon Apr 17, 2006 9:24 am
by icelizard
OK, i am having a problem, i have got lots of images stored on my database, and i want to display them, easy enough, but how would i auto thumbnail then?

I can thumnail images, and i can retrieve images from database but how would i do them together?!

to make that a bit more clear,

to thumbnail an image i would call thumb.php (img src = thumbnail.php?im=imagename.jpg)

to get image from database i call <img src="display.php?id=<? echo "$row[0]"; ?>">

but i just cant see a way round getting the image from the database then thumnailing it as calling from database is just getting the data from blob field then displaying it as an image. I have looked and looked for a solution with nu luck so far

Hope this explains it a bit better

Cheers for any help

Posted: Mon Apr 17, 2006 9:31 am
by feyd
look at the multitude of thumbnailing classes and functions we've got around this forum (search onion2k's posts)

Instead of using imagecreatefrompng() or similar, use imagecreatefromstring(). You should be warned that creating thumbnails on the fly (and not caching/storing them) will seriously slow down page responses and greatly increase CPU utilization and memory usage.

Posted: Mon Apr 17, 2006 9:38 am
by icelizard
all i do to create the image is

<img src="display.php?id=<? echo "$row[0]"; ?>">

//display.php

Header( "Content-type: $type");
echo $data;

where $data = the blob field

Posted: Mon Apr 17, 2006 10:17 am
by icelizard
i have resolved this problem now. thanks

Posted: Mon Apr 17, 2006 10:53 am
by John Cartwright
Why don't you post the solution so that others viewing the thread may benefit as well?