Question and idea regarding the image editor in 5.7

Permalink
Preface:
In an ideal situation, I would like to automate the the process of creating thumbnails. Thumbnail creation was handled in 5.6 with the image helper and it sounds like there is something in place to do it in 5.7.

I've been keeping up with this thread, but am still confused on the topic
http://www.concrete5.org/community/forums/5-7-discussion/image-help...

Until there is documentation on how to generate thumbnails in 5.7 - thumbnails have to be created manually. This makes the new image editor in 5.7 very useful with its ability to scale, crop, and resize images.

The image editor has a workflow/usability issue. When an image is edited and saved in the image editor, it overwrites the original. I predict a lot of users will be frustrated having to upload a second copy of the image with a different file name.

It would be helpful if the new 5.7 image editor had a "save as" option. This way they could save a copy as the thumbnail.

MrKDilkington
 
core77 replied on at Permalink Reply
Totally agree with you, Karl. Save as would be very nice.

For getting Thumbnails I temporarily use
$thumbnail = $f->getDetailThumbnailImage();
or
$thumbnail = $f->getListingThumbnailImage();

For me, ListingThumbnails are too small and DetailThumbnails are too large :-) I'm looking forward to see some docs on
- how to create Thumbnails and
- how to get different Image sizes for responsive design (small, medium, large image)

Chris
MrKDilkington replied on at Permalink Reply
MrKDilkington
Hi Chris,

Using $f->getDetailThumbnailImage() and $f->getListingThumbnailImage() is an interesting approach.

There is a great technique for using composer to generate galleries from filesets (credit Mesuva). It doesn't work without being able to generate thumbnails though. So I am eagerly awaiting the 5.7 documentation.
andrew replied on at Permalink Reply
andrew
You can create your own thumbnail types. If you go into

Dashboard > System and Settings > Files > Thumbnails

You can add a thumbnail type. Then, if you rescan all your existing images, thumbnails will automatically be generated. Then, if a particular thumbnail isn't right, you can go into the File properties for that image, and look for the "Thumbnails" header, with a number to the right. Click on that number, and you'll see a list of all the thumbnails available for that file, along with a link to an instance of the image editor to change just that thumbnail.

Then you can use some methods on the \Concrete\Core\File\Version object to work with the file. If the thumbnail type you added has the handle "gallery" and you're working with a $file object on the front-end, for a particular image.

$type = \Concrete\Core\File\Image\Thumbnaoil\Type\Type::getByHandle('gallery');
$src = $file->getThumbnailURL($type);
print '<img src="' . $src . '" />';


This code is pretty new and undocumented, and we're currently really only using thumbnails for responsive stuff rather than for what you're trying to use it for – but it's definitely been added with both use cases in mind. Hopefully this will get you on the right track. This is definitely something we're going to document very soon.
MrKDilkington replied on at Permalink Reply
MrKDilkington
The auto-generate thumbnail feature is very cool.

I tried using the code you posted, but received an error.

An unexpected error occurred.
Call to a member function getThumbnailURL() on a non-object
core77 replied on at Permalink Reply
Karl: do you still receive the error in 5.7.1?

I didn't test the above code yet...
MrKDilkington replied on at Permalink Reply
MrKDilkington
Yes, I tried it in 5.7.1 and received an error.

See if it works for you.
core77 replied on at Permalink Reply
Had a conversation in irc chat with EC-Joe and it didn't work, too. That was in 5.7.0.4.
https://github.com/EC-Joe/foundation_sites/blob/clearing/blocks/clea...

I'll try out 5.7.1 these days...
core77 replied on at Permalink Reply
Very nice! Got it working.

How can we say the thumbnails to be generated with JPEG quality of 80?