2010-02-09 49 views

回答

1

我认为你必须与imagecolorallocate()指定它:

// sets some colors 
$white = imagecolorallocate($im, 255, 255, 255); 
$black = imagecolorallocate($im, 0, 0, 0); 

// hexadecimal way 
$white = imagecolorallocate($im, 0xFF, 0xFF, 0xFF); 
$black = imagecolorallocate($im, 0x00, 0x00, 0x00); 

通过the man pages

1
Example of USE as it is not given above...... 



    // File and rotation 
    $filename = 'test.jpg'; 
    $degrees = 355; 

    // Content type 
    header('Content-type: image/jpeg'); 

    // Load 
    $source = imagecreatefromjpeg($filename);  
    $white = imagecolorallocate($source, 255, 255, 255); 

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

    // Output 
    imagejpeg($rotate); 
-1

,如果你做只有90,180,270度旋转 - 颜色并不重要 - 那么你可以使用:

imagerotate($image, $degrees, 0); 

避免代码混乱(可与PHP 5.6.x )