Question

I am trying to rotate an image through GD Library and a database value:

// Image for rotating
 $image = 'images/weather-icons/windDir.png';

 //degrees from database
 $degrees = $row[WindDirDegrees];




 // Create the canvas
 $source = imagecreatefrompng($image) ;

 // Rotate the image
 $rotate = imagerotate($source, $degrees, 0) ;

 // Outputs 
 imagepng($rotate) ;

But all I get as output is a huge amount of "gibbergabber" symbols. Does anyone know why?

Was it helpful?

Solution

You are missing header('Content-Type: image/png');

See: http://www.php.net/manual/en/function.imagepng.php

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top