刪除了原始圖片保留了操作後的圖片
/**
* 縮小圖片函數
* @param string $fileName
* @return void
*/
private function createSmallImg($fileName)
{
list($width,$height,$type,$attr) = getimagesize($fileName);
$imgOld=imagecreatefromjpeg($fileName);
$imgObj=imagecreatetruecolor($width-100,$height-100);
if(function_exists('imagecopyresampled'))
{
imagecopyresampled($imgObj,$imgOld,0,0,0,0,$width-100,$height-100,imagesx($imgOld),imagesy($imgOld));
}
else
{
imagecopyresized($imgObj,$imgOld,0,0,0,0,$width-100,$height-100,imagesx($imgOld),imagesy($imgOld));
}
imagedestroy($imgOld);
unlink($fileName);
imagejpeg($imgObj,$fileName,100);
chmod($fileName,0777);
imagedestroy($imgObj);