문제

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?

도움이 되었습니까?

해결책

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

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

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top