I'm trying to clean up my editing interface so that all Atom References in Editor Representation context are the same height/width. For images, I use the Image Style (Transcoder) selection in the Context form. For Video, I use the default player and impose height/width (to match Image style height/width) using the height/width inputs in contexts form.

My assumption is that, when not using the Galleria player for Atom Reference fields, the thumbnail field for Scald Gallery atoms will be displayed (this is correct) and will use the Image style setting in the Context form Transcoder selector (this is not correct - it always uses 'Library' style which is teeeeeeeeny-tiny by default). Try as i might, i could not control the image style used on Scald Gallery atom thumbnail.

I discovered that the scald module calls scald_dnd_library module's 'scald_render' hook and, for scald_gallery atoms, there is no thumbnail_transcoded_url value, so scald_dnd_library defaults to 'library' style.

So, why do Scald Images use the Transcoder styles per context and Scald Gallery atom thumbnail does not?

I believe it is because Scald Image has a hook_scald_prerender instance that properly handles the transcoding, but scald_gallery does not, probably because, in most cases, user wants to use the Galleria player. Because the Galleria player does not work in CKEditor iframes, yet, and the "grid of slides", that results from dropping a scald_gallery atom into CKEditor, spills over into Body text and over other atom references, I want to simple display the gallery by its thumbnail, when using the Editor Representation context.

I am able to achieve this by switching 'Galleria' back to 'default player', then simply copying and pasting, and renaming, the scald_image hook_scald_prerender function from scald_image.module into scald_gallery.module. This is obviously not a proper solution, but the result is I can control the display style of non-Galleria gallery atom references.

Would it be possible to add this hook to scald_gallery (probably modified from the scald_image version as it may be overkill to use the entire thing - I haven't delved into it) to allow Scald Gallery to use the Transcoder Image styles when NOT using the Galleria player?

Sorry so long-winded. Thanks for great module!

CommentFileSizeAuthor
#2 scald_gallery-prerender-2776169-2.patch3.2 KBgifad

Comments

ccshannon created an issue. See original summary.

gifad’s picture

Status: Active » Needs review
StatusFileSize
new3.2 KB

The attached patch implements a hook_scald_prerender() in case the atom is rendered with a player other than scald_galleria.
The atom will then be rendered like an image atom with the same thumbnail.

nagy.balint’s picture

Status: Needs review » Needs work

Thanks for the patch.

Indeed once we clean up that function we can consider it for commit.

gifad’s picture

@nagy.balint : can you please point out what's dirty in that function ?
The code here is a strict copy/paste from the relevant part of scald_image_scald_prerender()

nagy.balint’s picture

As far as I understand the patch will render a gallery in case there is no player, by simply displaying the thumbnail image applying a transcoder selected at the context.

1. For the question in the patch, indeed something like this can be used: https://www.drupal.org/files/issues/file_representation_to-2766301-2.patch
As likely we should allow full control to the player.

2. I was wondering if we need the picture module support. I guess if we build a list page of galleries, and then the gallery thumbnails can have different image styles per screen size, that could be a valid use case.
Its interesting though that the scald_image module only defines the format to be "image" for its transcoders, yet they appear everywhere.

3. An idea: If the thumbnail is empty, then we could check the first image from the atom reference field, and render that instead (and only consider it completely empty if both the thumbnail and all the items contain no images at all. As in that case we would get a placeholder image which might not be that good to display in a bigger space.

(4. Otherwise it would be nice to not have all this code duplication, but that could only be fixed by either making some kind of a render function in core which would bump the dependency version number, or if the thumbnail would be an atom reference, in which case we could simply render the atom as an image.
It was already a request though to have the thumbnail as an atom reference, but probably too much work is involved as it would need an update hook to convert all previous thumbnails as well.
So likely we cannot avoid it for now.)

  • nagy.balint committed 0850d0b on 7.x-2.x authored by gifad
    Issue #2776169 by gifad, nagy.balint: Scald Gallery does not have a...
nagy.balint’s picture

Status: Needs work » Fixed

Committed with 1. fixed.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

ccshannon’s picture

Btw, forgot to say THANKS for adding this. Works great!!! Now all my reference thumbnail images in CKEditor and Atom Reference fields are same size, regardless of atom type. :)