PHP interesse |
|
Ik heb een bestaande afbeelding en wil die resizen 100 X 100 als ik hem resize krijg ik volgende foutmelding: Fatal error: Call to undefined function imagecreatetruecolor() in D:\test.php on line 13. Wat heb ik verkeerd gedaan, hier volgt mijn code.
<?php
// Load image
$gecomd = chmod("flower.jpg", 0777);
$image = fopen("flower.jpg", "r");
if ($image === false) { die ('Unable to open image'); }
// New width and height
$new_width = 50;
$new_height = 50;
// Resample
$image_resized = imagecreatetruecolor($new_width, $new_height);
// Get original width and height
$width = imagesx($image);
$height = imagesy($image);
imagecopyresampled($image_resized, $image, 0, 0, 0, 0, $new_width, $new_height, $width, $height);
// Display resized image
header('Content-type: image/jpeg');
imagejpeg($image_resized);
die();
?>
<?php // Load image $gecomd = chmod("flower.jpg", 0777); $image = fopen("flower.jpg", "r"); if ($image === false) { die ('Unable to open image'); } // New width and height $new_width = 50; $new_height = 50; // Resample $image_resized = imagecreatetruecolor($new_width, $new_height); // Get original width and height $width = imagesx($image); $height = imagesy($image); imagecopyresampled($image_resized, $image, 0, 0, 0, 0, $new_width, $new_height, $width, $height); // Display resized image header('Content-type: image/jpeg'); imagejpeg($image_resized); ?>
|