lundi 4 juin 2018

Image Intervention for temporary thumbnail

I want to use Image Intervention in my Laravel application to try and create temporary thumbnails, does anyone know if this is possible?

I am currently storing the image url in the database when the file is uploaded, I then want to be able to pull the url back down and use it to create a thumbnail and display it in my view.

Something like this,


<?php
$url = '/'.str_replace('public','storage', $attachment->attachment_name);
echo $url; //This url is correct
$newImg = Image::make($url)->resize(300, 200);
print_r($newImg);

Something to note, which is probably obvious from the code snippet above is that the image is stored in the storage folder. There is a symbolic link made so that anything that goes to /storage/ will allow me to view the images in the storage folder.

I can view the images properly via the symbolic link URL, so the image should be retrievable by Image Intervention, but at the moment i'm receiving the error

Image source not readable

Is it even possible to use Image intervention for temporary file manipulation, or will I have to revert to something like TimThumb for this?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire