Re: resize image and store it to DB

From: Date: Wed, 02 May 2007 20:21:36 +0000
Subject: Re: resize image and store it to DB
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-254266@lists.php.net to get a copy of this message
On Tue, May 1, 2007 5:54 am, Alain Roger wrote: >> else // both $width and $height are smaller than max, so we need to >> zoom Zooming an image is RARELY satisfactory in appearance... I'd say just leave it alone, personally. >> $escaped = pg_escape_bytea($thumb); // does not work and it's normal > > $thumb is an image, so ho can i make it useful for pg_escape_bytea > function > ? $thumb isn't the actual JPEG image. It's just a PHP resource number, pointing to the image. So, essentially, you are cramming the number "3" (or "2" or "4" or whatever) into PostgreSQL. You would need to do something not unlike: ob_start(); imagejpeg($thumb); $image = ob_get_contents(); ob_end_clean(); $escaped = pg_escape_bytea($image); //Insert obligatory "don't store images in DB flame-war here" :-) -- Some people have a "gift" link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So?

« previous php.general (#254266) next »