Exemplo n.º 1
0
 function multy_update_photo_catalog($id)
 {
     //echo "<pre>".print_r($_FILES,1)."</pre>";
     // проверяем на картинку
     for ($i = 1; $i <= COUNT_PHOTO_CATALOG; $i++) {
         // имя картинки
         $file_name = "file" . $i;
         if ($_FILES[$file_name]['name'] != "") {
             $name_file_destination = $id . '_' . $i . '.jpg';
             // -------------------------------------------------------------------
             $fileuplo = HOST . IMG_CATALOG_PATH . '/' . md5($_FILES[$file_name]['name']);
             move_uploaded_file($_FILES[$file_name]['tmp_name'], $fileuplo);
             // -------------------------------------------------------------------
             // большое
             $filename = HOST . IMG_CATALOG_PATH . '/03/' . $name_file_destination;
             images::img_resize($fileuplo, $filename, _SIZE_03_W, _SIZE_03_H, false, 0);
             // среднее фото
             $filename1 = HOST . IMG_CATALOG_PATH . '/02/' . $name_file_destination;
             images::img_resize($fileuplo, $filename1, _SIZE_02_W, _SIZE_02_H, false, 0);
             // маленькое фото
             $filename2 = HOST . IMG_CATALOG_PATH . '/01/' . $name_file_destination;
             images::img_resize($fileuplo, $filename2, _SIZE_01_W, _SIZE_01_H, false, 0);
             if (SAVE_ORIGINAL_PHOTO) {
                 $filename3 = HOST . IMG_CATALOG_PATH . '/original/' . $name_file_destination;
                 images::img_resize($fileuplo, $filename3, _SIZE_03_W, _SIZE_03_H, false, 0);
             }
             // + watermark
             if (WATERMARK_CATALOG) {
                 images::img_watermark($filename);
             }
             // удаляем загруженное фото
             if (file_exists($fileuplo)) {
                 unlink($fileuplo);
             }
         }
     }
 }