inital commit

This commit is contained in:
2024-02-01 09:53:53 +00:00
commit 9743fce12b
19771 changed files with 4230637 additions and 0 deletions

30
app/Helpers/Compress.php Normal file
View File

@@ -0,0 +1,30 @@
<?php
namespace App\Helpers;
use Intervention\Image\Facades\Image as Image;
class Compress
{
public static function resize($path, $width = 400, $height = 320)
{
/// get size
list($width_orig, $height_orig) = getimagesize($path);
$ratio_orig = $width_orig / $height_orig;
if ($width / $height > $ratio_orig) {
$width = $height * $ratio_orig;
} else {
$height = $width / $ratio_orig;
}
$size['width'] = $width ?? 0;
$size['height'] = $height ?? 0;
$img = Image::make($path)
->resize($size['width'], $size['height'])
->save();
}
}