Mijn onderstaande script werkt niet op nieuwe server. Volgend log moet het liggen aan: imagecreatefromjpeg()
Iemand een idee wat er mis gaat. Bestanden tot 1 mb doen het overigens wel.
groeten,
Michiel
<?
//Resize picture
function resize_picture ($remote_file, $image_source ) {
// some settings
$max_upload_width = 600;
$max_upload_height = 600;
imagejpeg($image_source,$remote_file,100);
chmod($remote_file,0644);
/******* GROOT FORMAAT AANPASSEN *******/
// get width and height of original image
list($image_width, $image_height) = getimagesize($remote_file);
if($image_width>$max_upload_width || $image_height >$max_upload_height){
$proportions = $image_width/$image_height;
if($image_width>$image_height){
$new_width = $max_upload_width;
$new_height = round($max_upload_width/$proportions);
}
else{
$new_height = $max_upload_height;
$new_width = round($max_upload_height*$proportions);
}
$new_image = imagecreatetruecolor($new_width , $new_height);
$image_source = imagecreatefromjpeg($remote_file);
imagecopyresampled($new_image, $image_source, 0, 0, 0, 0, $new_width, $new_height, $image_width, $image_height);
// Save the image as 'simpletext.jpg'
imagejpeg($new_image,$remote_file,100);
// Free up memory
imagedestroy($new_image);
}
/** END GROOT FORMAAT **/
imagedestroy($image_source);
}
?>
1.579 views