Add Image, Upload, UploadHelper.

This commit is contained in:
Alexander Demidov
2013-05-24 13:27:47 +04:00
parent 01adb01270
commit da77be4fdd
3 changed files with 180 additions and 0 deletions

25
UploadHelper.class.php Normal file
View File

@ -0,0 +1,25 @@
<?php
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;
}
}
public static function imageCheckMinSize($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;
}
}
}