Add use PATH_ROOT. Refactoring. Some fixes for checking file_exists, is_read, is_file in UploadHelper.
This commit is contained in:
@ -4,22 +4,26 @@ abstract class UploadHelper
|
||||
{
|
||||
public static function imageCompareAspectRatio($proportion, $file_path)
|
||||
{
|
||||
$imagesize = getimagesize($file_path);
|
||||
$proprtion_parts = explode('x', $proportion);
|
||||
if ($proprtion_parts[0] / $proprtion_parts[1] === $imagesize[0] / $imagesize[1]) {
|
||||
return true;
|
||||
} else {
|
||||
false;
|
||||
if (file_exists($file_path) && is_readable($file_path) && is_file($file_path)) {
|
||||
if ($imagesize = getimagesize($file_path)) {
|
||||
$proprtion_parts = explode('x', $proportion);
|
||||
if ($proprtion_parts[0] / $proprtion_parts[1] === $imagesize[0] / $imagesize[1]) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
public static function imageCheckMinSize($size, $file_path)
|
||||
public static function imageCompareSize($size, $file_path)
|
||||
{
|
||||
$imagesize = getimagesize($file_path);
|
||||
$size_parts = explode('x', $size);
|
||||
if ($imagesize[0] >= $size_parts[0] && $imagesize[1] >= $size_parts[1]) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
if (file_exists($file_path) && is_readable($file_path) && is_file($file_path)) {
|
||||
if ($imagesize = getimagesize($file_path)) {
|
||||
$size_parts = explode('x', $size);
|
||||
if ($imagesize[0] == $size_parts[0] && $imagesize[1] == $size_parts[1]) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user