0
我正在開發一個php網站。在這裏,我需要創建JPG,PNG和GIF圖像創建縮略圖創建png,jpg和gif圖像
的縮略圖見我當前的代碼
if (@$fileType=="image/gif")
{
$im=ImageCreateFromGIF($add);
$width=ImageSx($im); // Original picture width is stored
$height=ImageSy($im); // Original picture height is stored
$newimage=imagecreatetruecolor($n_width,$n_height);
imageCopyResized($newimage,$im,0,0,0,0,$n_width,$n_height,$width,$height);
if (function_exists("imagegif")) {
Header("Content-type: image/gif");
ImageGIF($newimage,$tsrc);
}
elseif (function_exists("imagejpeg")) {
Header("Content-type: image/jpeg");
ImageJPEG($newimage,$tsrc);
}
chmod("$tsrc",0777);
}////////// end of gif file thumb nail creation//////////
////////////// starting of JPG thumb nail creation//////////
if($fileType=="image/jpeg" or $fileType=="image/jpg"){
$im=ImageCreateFromJPEG($add);
$width=ImageSx($im); // Original picture width is stored
$height=ImageSy($im); // Original picture height is stored
$newimage=imagecreatetruecolor($n_width,$n_height);
imageCopyResized($newimage,$im,0,0,0,0,$n_width,$n_height,$width,$height);
ImageJpeg($newimage,$tsrc);
chmod("$tsrc",0777);
}
在這裏,我需要創建PNG圖像的縮略圖。但我不知道如何?
我可以在現有代碼中添加縮略圖創建png圖像嗎?
有誰知道嗎?
請依靠