Exemplo n.º 1
0
 $filemd5 = md5_file($file['tmp_name']);
 $filename = date("YmdHis") . $filemd5;
 $file_location = make_folder($savedirectory_attachment . "/", $savepath) . $filename;
 $db_file_location = $savepath . $filename;
 $abandonorig = false;
 $hasthumb = false;
 $width = 0;
 if ($isimage) {
     $maycreatethumb = false;
     $stop = false;
     $imagesize = getimagesize($file['tmp_name']);
     if ($imagesize) {
         $height = $imagesize[1];
         $width = $imagesize[0];
         $it = $imagesize[2];
         if ($it != 1 || !$Attach->is_gif_ani($file['tmp_name'])) {
             //if it is an animation GIF, stop creating thumbnail and adding watermark
             if ($thumbnailtype_attachment != 'no') {
                 //determine the size of thumbnail
                 if ($altsize == 'yes') {
                     $targetwidth = $altthumbwidth_attachment;
                     $targetheight = $altthumbheight_attachment;
                 } else {
                     $targetwidth = $thumbwidth_attachment;
                     $targetheight = $thumbheight_attachment;
                 }
                 $hscale = $height / $targetheight;
                 $wscale = $width / $targetwidth;
                 $scale = $hscale < 1 && $wscale < 1 ? 1 : ($hscale > $wscale ? $hscale : $wscale);
                 $newwidth = floor($width / $scale);
                 $newheight = floor($height / $scale);