本文整理匯總了PHP中ImageManager::isCorrectImageFileExt方法的典型用法代碼示例。如果您正苦於以下問題:PHP ImageManager::isCorrectImageFileExt方法的具體用法?PHP ImageManager::isCorrectImageFileExt怎麽用?PHP ImageManager::isCorrectImageFileExt使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類ImageManager
的用法示例。
在下文中一共展示了ImageManager::isCorrectImageFileExt方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: validateHotelHeaderImage
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;
}
}
示例2: validAddHotelOtherImage
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;
}
}
}
}
示例3: validateTestimonialsImages
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);
}
}
}
}
示例4: validateUpload
/**
* 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;
}
示例5: isCorrectImageExt
public static function isCorrectImageExt($data)
{
return ImageManager::isCorrectImageFileExt($data);
}