Hi,

Maybe you can do something like this (if you have access to GD on the
server):
<?
$str_image = my_function_to_read_image_from_db($_GET['id']);
$im_old = imagecreatefromstring($str_image);
$im_new = imagecreatetruecolor($_GET['width'], $_GET['height']);
imagecopyresampled($im_new, $im_old, 0, 0, 0, 0, $_GET['width'],
$_GET['height'], imagesx($im_old), imagesy($im_old));
header("Content-type: image/jpeg");
imagejpeg($im_new, '', 90);
?>

/Joakim


> -----Original Message-----
> From: Steve Vernon [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, July 02, 2002 9:43 PM
> To: [EMAIL PROTECTED]
> Subject: [PHP] FW: Help please!
> 
> 
> Hello,
>       I have a PHP script which gets data from a MySQL database and
> returns an image. So <img src="getdata.php?id=3"> returns the image of
> id 3 from the database. What I really want is to state width 
> is 100 and
> height is 100 for example so I do not have to downlaod the entire
> picture and specify the width and height as part of the image:
>       
>       Do not want     
>       <img src="getdata.php?id=3" width="100" height="100">
> 
>       WHat I want
>       <img src="getdata.php?id=3&width=100&height=100">
> 
>       WHich will be a lot quicker on the client side.
> 
>       I cannot make a permanent file to use when I get the information
> from the PHP database due to server security, only a tmpfile which the
> data can then be placed. But to use the image functions you need to
> specify a filename. THere does not seem to be a way to get 
> the filename
> of a file pointer so how do I do it please?
> 
>       I have asked the ISP to give me permissions to create files int
> he server directory but they will not let me. 
> 
>       Thanks you!
> 
>       Steve
> 
> 
> -- 
> PHP General 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