# Trouble rotating image

**URL:** <https://forum.kirupa.com/t/trouble-rotating-image/250382>\
**Category:** Uncategorized\
**Created:** [January 29, 2008, 4:30am UTC](https://forum.kirupa.com/t/trouble-rotating-image/250382 "2008-01-29T04:30:49Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![tge1986](https://avatars.discourse-cdn.com/v4/letter/t/ba8739/32.png) [@tge1986](https://forum.kirupa.com/u/tge1986)\
**Post date:** [January 29, 2008, 4:30am UTC](https://forum.kirupa.com/t/trouble-rotating-image/250382/1 "2008-01-29T04:30:49Z")

</div>

i can’t get the read\_exif\_blablab whatever to work so i created a entry in the database to inform the page of the orientation of the image, if the value is one then the image needs to be rotated 90 degrees, well i got it to work when i declare the image name as plain text but when i try to get it to read it in a variable all hell breaks loose image turns into a text nightmare. is their a way to get this to work? here is the source code

```php
if($temp[6]==0){
        echo '<img src='.'"'.$temp[2].'"'.">";
        }else{
        
        $image = $temp[1];

//How many degrees you wish to rotate
$degrees = 90;
// Create the canvas
$source = imagecreatefromjpeg("italy/".$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) ;

```
