Hi Dan,
I don't know about resizing it from blob, I usually store the image on the
server and just the file name in the database . But I use something like
this for resizing:

$size = GetImageSize($filenum);
$im_in = ImageCreateFromJpeg($filenum);
$h1=$h; //were $h is the height that you want the image to have. The same
you can specify a width and calculate the height.
$w1=$h1/($size[1]/$size[0]);
$im_out = ImageCreate($w1,$h1);
ImageCopyResized($im_out,$im_in,0,0,0,0,$w1,$h1,$size[0],$size[1]);
ImageJpeg($im_out,$filenum);
ImageDestroy($im_in);
ImageDestroy($im_out);

You will need to have the GD Library installed with your php.
Hope it helps,
Cami

----- Original Message -----
From: "Dan Koken" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Friday, July 05, 2002 11:19 AM
Subject: [PHP-DB] Re: resizing images comming out of blobs


> Andy,
> Yes I do it all the time. In this example, I do this with a window that
> has buttons across the top of a image representing size from 1 to 10.
> Depending on the button they select they get a image displayed from
> small to large.
>
> Here is a snip of code that displays the sized images.
> ----------------------------
> The button name is $s. They select from 1 to 10, but can be any increment.
> $hi = $s * 100; // size in 100 pixels. (but can be any increment)
> echo "
> <TABLE BORDER='15' CELLPADDING='0' CELLSPACING='0'><TR><TD>
> <image src='ft_image.php?imno=$image_num' BORDER=0 ALIGN='TOP'
> height=$hi></TD></TR></TABLE>
> ";
>
> Note: in the 'image src' you give it a program name, not the image, and
> pass some way for it to read the image from the DB. In this case the
> program is ft_image.php and it passes imno.
>
> To didplay the photo in ft_image.php, execute the following:
>
>          header("Content-type:  image/jpeg");
>          print(mysql_result($result, 0, "photo_image"));
>
> photo_image is name of blob field from the DB
> ---------------------------------
> HTH.. Good luck.. Dan.
>
> ===========================================================
> Andy wrote:
> > Hi there,
> >
> > I am wondering how to resize an image which is stored in a mysql blob
field.
> >
> > With files this workes just fine, but how to do this with the image
comming
> > from blob? Has anybody done this already?
> >
> > Thank you for any help on that,
> >
> > andy
> >
> >
>
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>


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

Reply via email to