Re: resize image and store it to DB

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux