$img->resize(null, $size_y, true); $img->save($store->filename($resized->resizedname)); $resized->width = $img->width; $resized->height = $img->height; $resized->save(); } catch (Exception $e) { die('ERROR: ' . $e->getMessage()); } $response = $app->response(); $response['Content-Type'] = $resized->type; $response->body($store->get($resized->resizedname)); return; } else { if ($size_y && $size_x && ($picture->hdiff || $picture->wdiff)) { try { $img = Intervention\Image\Image::make($store->filename($picture->storename)); $resized = new RMAN\Models\ORM\Picture(['type' => $picture->type, 'name' => $picture->name, 'storename' => $picture->storename, 'resizedname' => $store->add($picture->storename), 'default' => 0]); if ($picture->width < $picture->height) { $img->resize($size_x, null, true); } else { $img->resize(null, $size_y, true); } $img->crop($size_x, $size_y); $img->save($store->filename($resized->resizedname)); $resized->width = $img->width; $resized->height = $img->height; $resized->save(); } catch (Exception $e) { die('ERROR: ' . $e->getMessage()); } $response = $app->response();