Page 1 of 1

imagerotate() help

Posted: Thu Nov 12, 2009 11:37 am
by m5638829
I have searched Google, this forum and several others to no avail, so here is my question:

I am using this code:

Code: Select all

<?php
// The file you are rotating
$image = 'myfile.jpg';
 
//How many degrees you wish to rotate
$degrees = 270;
 
// This sets the image type to .jpg but can be changed to png or gif
header('Content-type: image/jpeg') ;
 
// Create the canvas
$source = imagecreatefromjpeg($image) ;
 
// Rotates the image
$rotate = imagerotate($source, $degrees, 0) ;
 
// Outputs a jpg image, you could change this to gif or png if needed
imagejpeg($rotate) ;
?>
But the headers specify that it is an image. I need this rotated image to display in an html page.

I have tried this:

Code: Select all

<td><img src='";
//
$image = $row['logo'];
$degrees = 270 ;
$source = imagecreatefromjpeg($image) ;
$rotate = imagerotate($source, $degrees, 0) ;
imagejpeg($rotate) ;
 
echo "' alt='Jobs' /></td>
This is without sending headers and it just comes up with showing no image, but the alt comes up. Please help me with this issue.