Beispiel #1
0
         exit;
     }
     $type = strstr($picname, '.');
     if ($type != ".gif" && $type != ".jpg" && $type != ".png") {
         echo 'invalid image type';
         exit;
     }
     $rand = rand(10000, 99999);
     $pics = strstr($picname, '.', true) . date("YmdHis") . $rand . 'thumbnail' . $type;
     $pic_path = "public_html/img/productImg/" . $pics;
     move_uploaded_file($_FILES['edit_thumbnail_photo_input']['tmp_name'], $pic_path);
     $thumbnail_exist = $photoMgr->checkThumbnail($product_id);
     if ($thumbnail_exist == false) {
         $photoMgr->AddPhoto($product_id, "thumbnail", $pic_path);
     } else {
         $photoMgr->updatePhoto($product_id, "thumbnail", "thumbnail", $pic_path);
         unlink($existingPhotoList['thumbnail']);
     }
 }
 $originalColorStr = $productMgr->getColor($product_id);
 $colorArr = explode(",", $originalColorStr);
 $photo_name_arr = ['edit_1_photo_input', 'edit_2_photo_input', 'edit_3_photo_input', 'edit_4_photo_input'];
 $imgColor = "";
 $imgOriginalColor = "";
 foreach ($photo_name_arr as $photo_name) {
     $picname = $_FILES[$photo_name]['name'];
     $picsize = $_FILES[$photo_name]['size'];
     if ($picname != "") {
         if ($picsize > 5120000) {
             echo 'image size cannot exceed 5m';
             exit;