imageistruecolor

(PHP 4 >= 4.3.2, PHP 5)

imageistruecolorFinds whether an image is a truecolor image

說明

bool imageistruecolor ( resource $image )

imageistruecolor() finds whether the image image is a truecolor image.

參數

image

由影像建立函式(例如imagecreatetruecolor())回傳的影像資源。

回傳值

Returns TRUE if the image is truecolor, FALSE otherwise.

範例

Example #1 Simple detection of true color image instances using imageistruecolor()

<?php
// $im is an image instance

// Check if image is a true color image or not
if(!imageistruecolor($im))
{
    
// Create a new true color image instance
    
$tc imagecreatetruecolor(imagesx($im), imagesy($im));

    
// Copy over the pixels
    
imagecopy($tc$im0000imagesx($im), imagesy($im));
    
imagedestroy($im);

    
$im $tc;
    
$tc NULL;

    
// OR use imagepalettetotruecolor()
}

// Continue working with image instance
?>

註釋

Note: 本函式需要 GD 2.0.1 或更高版本(推薦 2.0.28 及更高版本)。

參見

add a note add a note

User Contributed Notes

There are no user contributed notes for this page.
To Top