PHP interesse |
|
ik gebruik de functie imagecreatefrom(jpeg,gif,png)
maar als ik dit aanwil roepen krijg ik de volgende fout
Fatal error: Call to undefined function: imagecreatefrompng() in D:\Data\Web\webroot\albums\1\blaat.php on line 2
ik gebruik php 4 met apache 2
alvast bedankt voor de reactie, als je t hele script wil zien, kijk hier onder
<?php
function miniature($pict, $dest_pict){
if(substr($pict,strrpos($pict, ".")) == ".png") {
$handle = imageCreateFromPng($pict);
} elseif(substr(strtolower($pict),strrpos($pict, ".")) == ".jpg" ){
$handle = imagecreatefromjpeg($pict);
} elseif(substr(strtolower($pict),strrpos($pict, ".")) == ".gif") {
$handle = imagecreatefromgif($pict);
} elseif(substr(strtolower($pict),strrpos($pict, ".")) == ".bmp") {
$handle = imagecreatefromwbmp($pict);
}
$x=imagesx($handle);
$y=imagesy($handle);
if($x > $y){
$max = $x;
$min = $y;
}
if($x <= $y){
$max = $y;
$min = $x;
}
$size_in_pixel = '100';
$rate = $max/$size_in_pixel;
$final_x = $x/$rate;
$final_y = $y/$rate;
if($final_x > $x) {
$final_x = $x;
$final_y = $y;
}
$final_x = ceil($final_x);
$final_y = ceil($final_y);
$black_picture = imageCreatetruecolor($final_x,$final_y);
imagefill($black_picture,0,0,imagecolorallocate($black_picture, 255, 255, 255));
imagecopyresampled($black_picture, $handle, 0, 0, 0, 0,$final_x, $final_y, $x, $y);
if(!imagejpeg($black_picture,$dest_pict.'/'.$pict, $size_in_pixel))
imagestring($black_picture, 1, $final_x-4, $final_y-8, ".", imagecolorallocate($black_picture,0,0,0));
imagejpeg($black_picture,'', '100');
imagedestroy($handle);
imagedestroy($black_picture);
}
?>
<?php function miniature($pict, $dest_pict){ $handle = imageCreateFromPng($pict); $handle = imagecreatefromjpeg($pict); $handle = imagecreatefromgif($pict); $handle = imagecreatefromwbmp($pict); } $x=imagesx($handle); $y=imagesy($handle); if($x > $y){ $max = $x; $min = $y; } if($x <= $y){ $max = $y; $min = $x; } $size_in_pixel = '100'; $rate = $max/$size_in_pixel; $final_x = $x/$rate; $final_y = $y/$rate; if($final_x > $x) { $final_x = $x; $final_y = $y; } $final_x = ceil($final_x); $final_y = ceil($final_y); $black_picture = imageCreatetruecolor($final_x,$final_y); imagefill($black_picture,0,0,imagecolorallocate($black_picture, 255, 255, 255)); imagecopyresampled($black_picture, $handle, 0, 0, 0, 0,$final_x, $final_y, $x, $y); if(!imagejpeg($black_picture,$dest_pict.'/'.$pict, $size_in_pixel)) imagestring($black_picture, 1, $final_x-4, $final_y-8, ".", imagecolorallocate($black_picture,0,0,0)); imagejpeg($black_picture,'', '100'); imagedestroy($handle); imagedestroy($black_picture); } ?>
|