Compress picture retrieved from database

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
mariusiik
Forum Newbie
Posts: 1
Joined: Thu Oct 20, 2005 5:31 pm

Compress picture retrieved from database

Post by mariusiik »

Hy,

i was wondering if there is a way to compress a picture retrieved from a blob field in a database and show it (compressed) on a page.

I managed so far to display it as the original picture but I want to compress it.

One solution I found was using the "imagecopyresampled" function but that requires a resource from a file on the hdd.

Any ideas?

Best regards!
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

imagecreatefromstring()

realtime resizing of images is very cpu intensive, I'd suggest storing the resized version somewhere.. I'd also suggest to not store images in the database unless you cannot store files on the server...
Post Reply