[Phpwm] displaying images on screen

Marc Gale marc at sbc.ac.uk
Thu Oct 2 13:06:29 UTC 2008


Hi Alan,

You need to use the imagejpeg() function

http://uk.php.net/manual/en/function.imagejpeg.php

Assuming of course that the PHP script is *only* doing this and isn't 
outputting anything else, as it also needs to send an image header to 
the browser first.

In your case, you would have something like:

$im1 = imagecreatefromjpeg($pathname.$filename);
$im1 = imagerotate($im1,-90,0);
header('Content-type: image/jpeg');
imagejpeg($im1);
imagedestroy($im1);

Marc

alan dunn wrote:
> This probably has an easy answer, but we haven't found it.
>
> We have an archive of jpeg images. We want to open one using GD library
>
> $im1 = imagecreatefrom jpeg($pathname.$filename);
>
>  rotate it:
>
> $im1 = imagerotate($im1,-90,0);           .... and display it on screen.
>
> How do we get to display the image which is now represented by resource 
> $im1?
> We know you can do it by saving the rotated image back to somewhere then 
> displaying the saved image - but that's a lot of overhead just to show a 
> temporarily rotated image.
>
> Any help much appreciated, thanks, Alan Dunn
>
>
>   

-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.




More information about the Phpwm mailing list