示例#1
0
         exit;
     }
     $newNameFile = $id;
     $newNameFile .= '.' . $image_info['extension'];
     $uploadfile = $targetPath . $newNameFile;
     // Удаляем фото
     $qwery = "SELECT photo \n                  FROM " . $name_dir . "\n                  WHERE id='" . $id . "'";
     $db->query($qwery);
     $photo = $db->getValue();
     $src_old = $targetPath . $photo;
     $thumb_old = $targetPath . "thumb_" . $photo;
     @unlink($src_old);
     @unlink($thumb_old);
     if (move_uploaded_file($tempFile, $uploadfile)) {
         $thumb = $targetPath . "thumb_" . $newNameFile;
         $imageClass->createImageThumb($uploadfile, $thumb, $maxWidthThumb, $maxHeightThumb);
         // Обновляем
         $qwery = "UPDATE " . $name_dir . "\n                      SET photo = '" . $newNameFile . "'\n                      WHERE id='" . $id . "'";
         $db->query($qwery);
     } else {
         echo "<p style='color:red;'>Файл большого изображения не загружен</p>";
         exit;
     }
 }
 if (($tempFile = $_FILES['url_image_small']['tmp_name']) != "") {
     $targetPath = $root . "/img/" . $name_dir . "/";
     if (!($image_info = $imageClass->getImageInfo($tempFile))) {
         echo "<p style='color:red;'>Обработка файла маленького изображения невозможна</p>";
         exit;
     }
     if ($image_info['extension'] != "png") {
示例#2
0
         if ($image_info['width'] != 910 || $image_info['height'] != 510) {
             echo "<p style='color:red;'>Допустимое разрешение фото для галереи 910 px * 510 px</p>";
             exit;
         }
         if ($image_info['extension'] != "png") {
             echo "<p style='color:red;'>Допустимые расширения для изображения *.png</p>";
             exit;
         }
         $file_name = md5(microtime()) . ".png";
         $qwery = "INSERT INTO news_galery \n                    (photo, id_news) \n                 VALUES \n                    ('" . $file_name . "', '" . $id . "')";
         $db->query($qwery);
         $src = $item;
         $src_save = '../../../img/news_gallery/' . $file_name;
         $thumb = '../../../img/news_gallery/' . "thumb_" . $file_name;
         $imageClass->resizeImage($src, $src_save, 910, 510);
         $imageClass->createImageThumb($src, $thumb, 128, 128);
     }
 }
 if (($tempFile = $_FILES['url_image']['tmp_name']) != "") {
     $targetPath = $root . '/img/news/';
     if (!($image_info = $imageClass->getImageInfo($tempFile))) {
         echo "<p style='color:red;'>Обработка файла изображения невозможна</p>";
         exit;
     }
     if ($image_info['width'] != 128 || $image_info['height'] != 128) {
         echo "<p style='color:red;'>Допустимое разрешение фото 128 px * 128 px</p>";
         exit;
     }
     if ($image_info['extension'] != "png") {
         echo "<p style='color:red;'>Допустимые расширения для изображения *.png</p>";
         exit;
示例#3
0
            echo "<p style='color:red;'>Допустимое разрешение {$maxWidthPortfolioBig} x {$maxHeightPortfolioBig} px</p>";
            exit;
        }
        if ($image_info['size'] > 1024 * 1024 * 10) {
            echo "<p style='color:red;'>Файл изображения больше 10 Мб</p>";
            exit;
        }
        $newNameFile = $id;
        $newNameFile .= '.' . $image_info['extension'];
        $uploadfile = $targetPath . $newNameFile;
        // Удаляем фото
        $qwery = "SELECT photo \n                  FROM portfolio\n                  WHERE id='" . $id . "'";
        $db->query($qwery);
        $photo = $db->getValue();
        $src_old = $targetPath . $photo;
        $thumb_old = $targetPath . "thumb_" . $photo;
        @unlink($src_old);
        @unlink($thumb_old);
        if (move_uploaded_file($tempFile, $uploadfile)) {
            $thumb = $targetPath . "thumb_" . $newNameFile;
            $imageClass->createImageThumb($uploadfile, $thumb, $maxWidthPortfolioThumb, $maxHeightPortfolioThumb);
            // Обновляем
            $qwery = "UPDATE portfolio\n                      SET photo = '" . $newNameFile . "'\n                      WHERE id='" . $id . "'";
            $db->query($qwery);
        } else {
            echo "<p style='color:red;'>Файл изображения не загружен</p>";
        }
    }
}
?>
 
示例#4
0
         exit;
     }
     $newNameFile = $id;
     $newNameFile .= '.' . $image_info['extension'];
     $uploadfile = $targetPath . $newNameFile;
     // Удаляем фото
     $qwery = "SELECT photo \n                  FROM before_after\n                  WHERE id='" . $id . "'";
     $db->query($qwery);
     $photo = $db->getValue();
     $src_old = $targetPath . $photo;
     $thumb_old = $targetPath . "thumb_" . $photo;
     @unlink($src_old);
     @unlink($thumb_old);
     if (move_uploaded_file($tempFile, $uploadfile)) {
         $thumb = $targetPath . "thumb_" . $newNameFile;
         $imageClass->createImageThumb($uploadfile, $thumb, $maxWidthBeforeAfterThumb, $maxHeightBeforeAfterThumb);
         // Обновляем
         $qwery = "UPDATE before_after\n                      SET photo = '" . $newNameFile . "'\n                      WHERE id='" . $id . "'";
         $db->query($qwery);
     } else {
         echo "<p style='color:red;'>Файл большого изображения не загружен</p>";
         exit;
     }
 }
 if (($tempFile = $_FILES['url_image_small']['tmp_name']) != "") {
     $targetPath = $root . '/img/before_after/';
     if (!($image_info = $imageClass->getImageInfo($tempFile))) {
         echo "<p style='color:red;'>Обработка файла маленького изображения невозможна</p>";
         exit;
     }
     if ($image_info['extension'] != "png") {