调整图像功能的大小不起作用

时间:2014-02-07 21:42:39

标签: php resize autoresize

使用此代码上传时,我在调整图片大小时遇到​​问题:

功能:

function compress_image($source_url, $destination_url, $quality) {
$info = getimagesize($source_url);

if ($info['mime'] == 'image/jpeg') $image = imagecreatefromjpeg($source_url);
elseif ($info['mime'] == 'image/gif') $image = imagecreatefromgif($source_url);
elseif ($info['mime'] == 'image/png') $image = imagecreatefrompng($source_url);

imagejpeg($image, $destination_url, $quality);

return $destination_url;
}

上传代码:

if ($_FILES['imagen1']['name'] != "") {
    $extension = end(explode('.', $_FILES['imagen1']['name']));
        $nombreNuevo = date("Y_n_j_H_i_s") . "_tew".rand(1,9999999);
        copy($_FILES['imagen1']['tmp_name'], "../images/soportew/".$nombreNuevo.".".$extension);
        $name1= $nombreNuevo. "." . $extension;
        compress_image($laImagen, $laImagen, 30);
}

任何帮助?

0 个答案:

没有答案