mam kod:
<?php $filename = 'index_07.png'; $percent = 0.5; // Content type // Get new dimensions $new_width = $width * $percent; $new_height = $height * $percent; // Resample $image_p = imagecreatetruecolor($new_width, $new_height); $image = imagecreatefrompng($filename); imagecopyresampled($image_p, $image, 0, 0, 0, 0, $new_width, $new_height, $width, $height); // Output imagepng($image_p, null, 100); ?>
i on nie działa, nie wiem dlaczego.
Dodam, że gdy robię identyczny kod tylko dla formatu .jpg to działa wyśmienicie.
<?php $filename = 'index_02.jpg'; $percent = 0.5; // Content type // Get new dimensions $new_width = $width * $percent; $new_height = $height * $percent; // Resample $image_p = imagecreatetruecolor($new_width, $new_height); $image = imagecreatefromjpeg($filename); imagecopyresampled($image_p, $image, 0, 0, 0, 0, $new_width, $new_height, $width, $height); // Output imagejpeg($image_p, null, 100); ?>
Dlaczego z .png się nie udaje?