"; echo "$bildneulink neu = $width X $height
"; $ret = resizeImage($link, $bildneulink, $width, $height, '60'); function resizeImage($file_name_src, $file_name_dest, $width = 0, $height = 0, $quality = 100){ if (file_exists($file_name_src) && isset($file_name_dest)){ if ($width == 0 && $height == 0){ return false; } $file_name_dest = $file_name_dest;//strtolower($file_name_dest); $est_src = @pathinfo($file_name_src);//pathinfo(strtolower($file_name_src)); $est_dest = @pathinfo($file_name_dest);//pathinfo(strtolower($file_name_dest)); $size = @getimagesize($file_name_src); if ($height && ! $width){ $h = number_format($height, 0, ',', ''); $w = number_format(($size[0]/$size[1])*$height,0,',',''); }else if (! $height && $width){ $w = number_format($width, 0, ',', ''); $h = @number_format(($size[1]/$size[0])*$width,0,',',''); }else { $h = number_format($height, 0, ',', ''); $w = number_format($width, 0, ',', ''); } if ($est_dest['extension'] == "gif" || $est_dest['extension'] == "jpg" || $est_dest['extension'] == "png"){ $dest = @imagecreatetruecolor($w, $h); @imageantialias($dest, TRUE); }else{ return FALSE; } switch($size[2]){ case 1: //GIF $src = imagecreatefromgif($file_name_src); break; case 2: //JPEG $src = imagecreatefromjpeg($file_name_src); break; case 3: //PNG $src = imagecreatefrompng($file_name_src); break; default: return FALSE; break; } imagecopyresampled($dest, $src, 0, 0, 0, 0, $w, $h, $size[0], $size[1]); switch($size[2]){ case 1: imagegif($dest,$file_name_dest); break; case 2: imagejpeg($dest,$file_name_dest, $quality); break; case 3: imagepng($dest,$file_name_dest); } return TRUE; } //return FALSE; } /* $im = imagecreatefromjpeg($link); $size = min(imagesx($im), imagesy($im)); $im2 = imagecrop($im, ['x' => 0, 'y' => 0, 'width' => $width, 'height' => $height]); if ($im2 !== FALSE) { imagepng($im2, $bildneulink); imagedestroy($im2); echo "Bild neu gespeichert
"; } imagedestroy($im); */