Date: 06/29/02
- Next message: CrossWalkCentral: "[PHP-DB] AVG fucntion help"
- Previous message: Rasmus Lerdorf: "[PHP-DB] Re: [PHP] saving temporary image to database"
- In reply to: Rasmus Lerdorf: "[PHP-DB] Re: [PHP] saving temporary image to database"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
... sorry I thought it would be to much code.
Here is the complete code :
$inputImg = ImageCreateFromJPEG($picture_location);
# old size
$srcX = imagesx($inputImg);
$srcY = imagesy($inputImg);
# new size
$ratio = ($srcY / $dstY);
$dstX = ($srcX / $ratio);
$outputImg = ImageCreateTrueColor($maxX, $dstY);
imagefill($outputImg, 0, 0, ImageColorAllocate($outputImg, 0, 0,0));
imagecopyresampled($outputImg, $inputImg, (($maxX - $dstX) / 2),0,0,0,
$dstX, $dstY, $srcX, $srcY);
#########################################
# save image to db into blob
// this does not work (outputImg is a the colorcorrected file)
$data = addslashes($outputImg);
// this one would work
# $data = addslashes(fread(fopen($picture_location, "r"),
filesize($picture_location)));
$stmt ="
INSERT INTO test.picture_test
(file_name, file_type, picture)
VALUES
('$name', '$picture_location_type', '$data')
";
execute_stmt($stmt, $link);
#########################################
"Rasmus Lerdorf" <rasmus <email protected>> schrieb im Newsbeitrag
news:Pine.LNX.4.44.0206290658330.2929-100000 <email protected>
> There is no imagejpeg() call in the code snippet you provided. And you
> don't say how it is failing. You haven't provided us with enough data to
> answer this question.
>
> -Rasmus
>
> On Sat, 29 Jun 2002, andy wrote:
>
> > Hi there,
> >
> > I would like to save a jpg into a blob field of mysql. The function
> > underneath works fine if I read the image from the temporary destination
> > where php did put it after uploading.
> >
> > My problem is, that I would like to do some funky stuff to the image
like
> > changing colors or adding watermarks. So I have several functions ahead
> > before I used to store them successfully to the file system. Now I would
> > like to store it to a blob field, but this does not work. Like I said it
> > works to store the temp file, but not the other one. I guess it has to
do
> > with something regarding the imagejpeg function.
> >
> > Here is what I tryed:
> > #########################################
> > # save image to db into blob
> >
> > // this does not work (outputImg is a the colorcorrected file)
> > $data = addslashes($outputImg);
> >
> > // this one would work
> > # $data = addslashes(fread(fopen($picture_location, "r"),
> > filesize($picture_location)));
> >
> > $stmt ="
> > INSERT INTO test.picture_test
> > (file_name, file_type, picture)
> > VALUES
> > ('$name', '$picture_location_type', '$data')
> > ";
> > execute_stmt($stmt, $link);
> > #########################################
> >
> > Maybe some of you guy has a good idea on that.
> >
> > Thanx for any help,
> >
> > Andy
> >
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
>
-- ---------------------------------------------- http://www.globosapiens.net Global Travellers Network-- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
- Next message: CrossWalkCentral: "[PHP-DB] AVG fucntion help"
- Previous message: Rasmus Lerdorf: "[PHP-DB] Re: [PHP] saving temporary image to database"
- In reply to: Rasmus Lerdorf: "[PHP-DB] Re: [PHP] saving temporary image to database"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

