public function __construct($path) { $this->image = Image::make($path); $this->name = $this->getUniqueName(); $this->isLandscape = $this->image->width() > $this->image->height(); // default 2:3 ratio $this->ratioLarge = 3; $this->ratioSmall = 2; }
if ($_REQUEST['uploadType'] == 'image') { $img = new image(); $img->createfromfile($target); if ($img->width() > $img->height()) { $left = ($img->width() - $img->height()) / 2; $img->cut($left, 0, $img->height(), $img->height()); } else { $top = ($img->height() - $img->width()) / 2; $img->cut(0, $top, $img->width(), $img->width()); } $img->resize(64, 64, true); $thumbtarget = getThumbUrl($target); $img->save($thumbtarget, 90); $img2 = new image(); $img2->createfromfile($target); if ($img2->width() > 640 || $img2->height() > 640) { $img2->resize(540, 540, true); } $midsizetarget = getMidsizeUrl($target); $img2->save($midsizetarget, 90); $image['url'] = $target; $image['dateCreated'] = date("Y-m-d H:i:s"); $image['id'] = $waka['maxImageId']; $image['name'] = basename($_FILES['uploaded']['name']); $item['images'][count($item['images'])] = $image; $item['dateImagesTouched'] = date("Y-m-d H:i:s"); } } } else { echo "Sorry, there was a problem uploading your file."; }