public function validateHotelHeaderImage($image)
 {
     if ($image['size'] > 0) {
         if ($image['tmp_name'] != "") {
             if (!ImageManager::isCorrectImageFileExt($image['name'])) {
                 $this->errors[] = Tools::displayError('<strong>' . $_FILES['header_image']['name'] . '</strong> : Image format not recognized, allowed formats are: .gif, .jpg, .png', false);
             }
         }
     } else {
         return true;
     }
 }
Exemplo n.º 2
0
 public function validAddHotelOtherImage($image)
 {
     if (empty($image['name'])) {
         return;
     }
     //if any one is invalid extension redirect
     foreach ($image['name'] as $img_name) {
         if ($img_name != "") {
             if (!ImageManager::isCorrectImageFileExt($img_name)) {
                 return true;
             }
         }
     }
 }
Exemplo n.º 3
0
 public function validateTestimonialsImages($image)
 {
     if (empty($image['name'])) {
         return;
     }
     //if any one is invalid extension redirect
     foreach ($image['name'] as $img_name) {
         if ($img_name != "") {
             if (!ImageManager::isCorrectImageFileExt($img_name)) {
                 $this->_postErrors[] = $this->l('Image format not recognized, allowed formats are: .gif, .jpg, .png', false);
             }
         }
     }
 }
Exemplo n.º 4
0
 /**
  * Validate image upload (check image type and weight)
  *
  * @param array $file Upload $_FILE value
  * @param integer $max_file_size Maximum upload size
  * @return bool|string Return false if no error encountered
  */
 public static function validateUpload($file, $max_file_size = 0)
 {
     if ((int) $max_file_size > 0 && $file['size'] > (int) $max_file_size) {
         return sprintf(Tools::displayError('Image is too large (%1$d kB). Maximum allowed: %2$d kB'), $file['size'] / 1000, $max_file_size / 1000);
     }
     if (!ImageManager::isRealImage($file['tmp_name'], $file['type']) || !ImageManager::isCorrectImageFileExt($file['name'])) {
         return Tools::displayError('Image format not recognized, allowed formats are: .gif, .jpg, .png');
     }
     if ($file['error']) {
         return sprintf(Tools::displayError('Error while uploading image; please change your server\'s settings. (Error code: %s)'), $file['error']);
     }
     return false;
 }
Exemplo n.º 5
0
 public static function isCorrectImageExt($data)
 {
     return ImageManager::isCorrectImageFileExt($data);
 }