function resize($file, $new_w, $new_h, $save) { { return false; } switch ($info['mime']) { case "image/gif": $file = imagecreatefromgif($file); break; case "image/jpg": $file = imagecreatefromjpeg($file); break; case "image/jpeg": $file = imagecreatefromjpeg($file); break; case "image/png": $file = imagecreatefrompng($file); break; default: $file = imagecreatefromjpeg($file); break; } //$sImage = file_get_contents($file); //$file = imagecreatefromstring($sImage); if ($old_x > $old_y) { $thumb_w=$new_w; $thumb_h=$old_y*($new_h/$old_x); } if ($old_x < $old_y) { $thumb_w=$old_x*($new_w/$old_y); $thumb_h=$new_h; } if ($old_x == $old_y) { $thumb_w=$new_w; $thumb_h=$new_h; } $old_x = imageSX($file); $old_y = imageSY($file); if($info[0] > 2000 or $info[1] > 2000) { $old_x = $info[0]; $old_y = $info[1]; } if ($old_x > $old_y) { $thumb_w=$new_w; $thumb_h=$old_y*($new_h/$old_x); } if ($old_x < $old_y) { $thumb_w=$old_x*($new_w/$old_y); $thumb_h=$new_h; } if ($old_x == $old_y) { $thumb_w=$new_w; $thumb_h=$new_h; } //imagecopyresized($thumb, $source, 0, 0, 0, 0, $newwidth, $newheight, $width, $height); $th = ImageCreateTrueColor($thumb_w, $thumb_h); imagecopyresampled($th, $file, 0, 0, 0, 0, $thumb_w, $thumb_h, $old_x, $old_y); switch ($info['mime']) { case "image/gif": $black = imagecolorallocate($th, 0, 0, 0); imagecolortransparent($th, $black); imagegif($th, $save); break; case "image/jpeg": imagejpeg($th, $save, 85); break; case "image/png": $black = imagecolorallocate($th, 0, 0, 0); imagecolortransparent($th, $black); imagepng($th, $save); break; default: imagejpeg($th, $save); break; } @imagedestroy($file); @imagedestroy($th); return true; }
dodam tylko że memory_limit mam na 128M.
Proszę o pomoc