imagerotate() help

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
m5638829
Forum Newbie
Posts: 1
Joined: Thu Nov 12, 2009 11:33 am

imagerotate() help

Post 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.
Post Reply