thephpleague / glide

Wonderfully easy on-demand image manipulation library with an HTTP based API.
http://glide.thephpleague.com
MIT License
2.55k stars 199 forks source link

Disable manipulations #269

Closed theprobugmaker closed 4 years ago

theprobugmaker commented 4 years ago

Is it possible to disable manipulations like fit and only use the resizing?

reinink commented 4 years ago

You can, of course, only use the API features you want, and ignore then ignore those you don't want. And, if you sign your image URLs, no one can change them. Meaning, you can use resizing, but not fit.

Alternatively, you can manually setup the server, and disable all the manipulators you don't want.

Hope that helps. 👍

theprobugmaker commented 4 years ago

Thank you for the answer. Here are two questions:

  1. For the signed urls, Laravel has a signedRoute method that allows that, is it just a matter of using it instead of the Glide one or I will need to do some more configuration to work with Laravel?
  2. Regarding the speed problem: I saw a few issues saying that serving images using PHP is really slow. In my situation I'm creating a classifieds website that will have more or less 1k ads on the first month and on the front page they will be listed using a small image, then inside the ad itself will have the gallery and so on, is this going to be an issue or I'm fine? I'm not an expert with NGINX or Apache for those things so maybe you can help me saying where I need to go (read) in order to make it faster. I also saw this article, don't know if this helps: https://medium.com/@joecohens/improving-glide-image-server-response-by-6x-with-php-ppm-and-zero-code-changes-180fd333cc09
reinink commented 4 years ago
  1. I'd use Glide's signed URLs.
  2. Test it if you're worried. If it's too slow, go with another approach. FWIW, tons of folks use Glide in production on larger sites. No, it's definitely not as fast as nginx/apache, but it's that often totally fine.

Good luck. 👍

theprobugmaker commented 4 years ago

I guess I will create a helper function to generate the signed URLs (if you have one I'd appreciate - or an example with Laravel) then and regarding the speed I will keep as it's and maybe in the future if I see something unusual I will try something (I hope I can change without breaking haha)

Thank you very much