joelesvensson
joelesvensson

A method to generate thumbs from images in the media library would be really nice. Like this:

MediaLibrary::thumb($pathToImage, $width, $height, $mode, $customOutputPath = null)
noideawhattotypehere
noideawhattotypehere

+1, its quite easy to write your own plugin but i feel like it should be in the core already since image attachments got this

daftspunk
daftspunk

Just to clarify, where would you expect the thumbnail to be created on the filesystem?

joelesvensson
joelesvensson

It doesn't really matter for me. Let me think about it. But spontaneously my suggestion would be a folder in storage/temp

GreenImp
GreenImp

This would be really handy! I'm sure a lot of people have a large image (A featured image for a blog post, for example), and also need to show a thumbnail version throughout the site.

d.negativa
d.negativa

daftspunk said:

Just to clarify, where would you expect the thumbnail to be created on the filesystem?

Maybe storage/app/media/.thumb/-----------.jpg

douglas14166
douglas14166

Just to throw out a possibility. Another CMS I use implements a system using defined 'transforms'. The transform includes title, handle, mode (crop, fit, or stretch), crop-position (top-left, top-center, top-right, etc.), height, width (either of which can be blank to autosize the missing dimension), quality setting (low, medium, high, very high, maximum), and image format (auto, jpg, gif, png). Named transforms can then be used to auto-generate transformed images at runtime using twig: <img src="{{ image.getUrl('thumb') }}" width="{{ image.getWidth('thumb') }}" height="{{ image.getHeight('thumb') }}">

Transforms can also be defined in the twig template dynamically: {% set thumb = {mode: 'crop', width: 200, height: 200, quality: 75, position: 'top-center'} %}

Transformed images are stored in a folder named after the transform (i.e. storage/app/media/_thumb).

Last updated

Codenator
Codenator

I think all this staff can be in plugins. Many CMS have it via plugins.

Sebastian Hilger
Sebastian Hilger

I made a plugin for something like this which is currently awaiting approval. You can find it here, if you want to try it: https://github.com/manogi/october-mediathumb

gergo85
Sebastian Hilger
Sebastian Hilger

Thanks! The plugin is now an official octobercms plugin: http://octobercms.com/plugin/manogi-mediathumb

webBook
webBook

Please, try to add width/height crop option. Otherwise great deal, thanks.

dobbler311350
dobbler311350

I made a pull request on github that adds cropping if you're still interested.

matthewpawley
matthewpawley

If its any help, I wrote a plugin recently to accomplish this - https://octobercms.com/plugin/toughdeveloper-imageresizer

It supports cropping out of the box, works with images anywhere on the filesystem, caches images and doesn't require any additional dependencies.

1-14 of 14