Support from Acquia helps fund testing for Drupal Acquia logo

Comments

jamesbenison’s picture

Here's a patch.

Basically this makes it possible to use youtube (via media youtube module) vimeo (via media vimeo module) and images with imagefield and media.

miro_dietiker’s picture

While this sounds interesting, note that now the galleria content has no html representation for e.g. search engines.
If we want to keep with that fallback, we should still add the output to the system and hide it...

jamesbenison’s picture

I'm sticking this patch up because it fixes some undefined index issues that showed up with the above patch. And FYI the patch was tested with the latest dev versions of file_entity and media.

As for the html representation, the technique I used was to set the dataSource option for a data array created in the theme function. Basically it's like you see here. By setting this it overrides any html inside the galleria selector and hides it. I took out the html in part because it causes a flash of unformatted content (FOUC) on page load, and it's extra code that slows down rendering.

Should we make the adding the html a menu option?

As an aside, the patch has the array keys for the galleria layers and links, but they're commented out. It would be nice to get some input on how to best add these. I was thinking maybe we could add a link field and a textarea to file entities.

jamesbenison’s picture

Title: Use JSON to unlock the power of Galleria » Load slides using json to get support for youtube, vimeo, links, and layers.
FileSize
12.56 KB

I've made a more comprehensive patch that adds support for all these things and corrects my redundancies in the title/alt support.

Also changing this thread title to something that makes a bit more sense.

jamesbenison’s picture

Category: task » feature
Status: Active » Needs review
FileSize
14.78 KB

This latest one keeps the image html for search engines and fixes views field mapping.

Please test and give feedback.

TimTheEnchanter’s picture

#5 worked for me. I was able to load youtube videos in via media_youtube module. Thanks for the patch!

jamesbenison’s picture

People are still reporting on similar issues. I'll clarify how to use the patch above to get these features working with the media module.

You'll need the latest galleria dev with the patch in #5 applied. Plus add media, file_entity, media_youtube, media_vimeo, and the link module. Note the versions I used in the screenshot.

Add fields to your image file entity (screenshot).

Add a content type with a file (not image) field and the media file selector widget (screenshot). Set up the field settings to allow image file types (with jpg, png extensions) plus video youtube and vimeo (screenshot).

On manage display, choose galleria and map the fields from your image file entity for title, description, layer, and link (screenshot).

Add images (screenshot), youtube (screenshot), and/or vimeo (screenshot).

Working galleria:
-Image slide with html layer and slide linked to drupal
-YouTube
-Vimeo

The views integration should also be working.

I'll go through and mark similar issues in the queue as duplicates.

thinkdrupal’s picture

Patch #5 is missing the fix on 'galleria-container.tpl.php' that is in patch #4.
I also had to make a change to the 'datasource'.... in the patch
// Add "data" array to galleria option "dataSource"
//$optionset->options['dataSource'] = $data;
$optionset['options']['dataSource'] = $data;

klavs’s picture

why only allow field type of type file - and not image as well ? (I have a lot of nodes - with a field type of image - that I'd not like to have to alter all of them :(

klavs’s picture

Anyone have it working with views?

I tried patch in #5 + additions from #8.

I don't see any layer_field (or link select_field) options (under galleria settings - or on the file field settings) - and upon display of the view,I only get a lot of errors:

Notice: Undefined property: stdClass::$uri in theme_file_link() (line 727 of .../modules/file/file.module).
Notice: Undefined property: stdClass::$filemime in theme_file_icon() (line 765 of .../modules/file/file.module).
Notice: Undefined property: stdClass::$filemime in file_icon_path() (line 809 of .../modules/file/file.module).
Notice: Undefined property: stdClass::$filemime in file_icon_map() (line 852 of .../modules/file/file.module).
Notice: Undefined property: stdClass::$filemime in file_icon_path() (line 824 of .../modules/file/file.module).
Notice: Undefined property: stdClass::$filemime in file_icon_path() (line 824 of .../modules/file/file.module).
Notice: Undefined property: stdClass::$filemime in file_icon_path() (line 824 of .../modules/file/file.module).
Notice: Undefined property: stdClass::$filemime in file_icon_path() (line 824 of .../modules/file/file.module).
Notice: Undefined property: stdClass::$filemime in theme_file_link() (line 734 of .../modules/file/file.module).
Notice: Undefined property: stdClass::$filesize in theme_file_link() (line 734 of .../modules/file/file.module).
Notice: Undefined property: stdClass::$filename in theme_file_link() (line 740 of .../modules/file/file.module).
Notice: Undefined property: stdClass::$uri in theme_file_link() (line 727 of .../modules/file/file.module).
Notice: Undefined property: stdClass::$filemime in theme_file_icon() (line 765 of .../modules/file/file.module).
Notice: Undefined property: stdClass::$filemime in file_icon_path() (line 809 of .../modules/file/file.module).
Notice: Undefined property: stdClass::$filemime in file_icon_map() (line 852 of .../modules/file/file.module).
Notice: Undefined property: stdClass::$filemime in file_icon_path() (line 824 of .../modules/file/file.module).
Notice: Undefined property: stdClass::$filemime in file_icon_path() (line 824 of .../modules/file/file.module).
Notice: Undefined property: stdClass::$filemime in file_icon_path() (line 824 of .../modules/file/file.module).
Notice: Undefined property: stdClass::$filemime in file_icon_path() (line 824 of .../modules/file/file.module).
Notice: Undefined property: stdClass::$filemime in theme_file_link() (line 734 of .../modules/file/file.module).
Notice: Undefined property: stdClass::$filesize in theme_file_link() (line 734 of .../modules/file/file.module).
Notice: Undefined property: stdClass::$filename in theme_file_link() (line 740 of .../modules/file/file.module).
Notice: Undefined index: und in theme_views_view_galleria() (line 165 of .../sites/all/modules/galleria/theme/theme.inc).
Notice: Undefined property: stdClass::$uri in theme_file_link() (line 727 of .../modules/file/file.module).
Notice: Undefined property: stdClass::$filemime in theme_file_icon() (line 765 of .../modules/file/file.module).
Notice: Undefined property: stdClass::$filemime in file_icon_path() (line 809 of .../modules/file/file.module).
Notice: Undefined property: stdClass::$filemime in file_icon_map() (line 852 of .../modules/file/file.module).
Notice: Undefined property: stdClass::$filemime in file_icon_path() (line 824 of .../modules/file/file.module).
Notice: Undefined property: stdClass::$filemime in file_icon_path() (line 824 of .../modules/file/file.module).
Notice: Undefined property: stdClass::$filemime in file_icon_path() (line 824 of .../modules/file/file.module).
Notice: Undefined property: stdClass::$filemime in file_icon_path() (line 824 of .../modules/file/file.module).
Notice: Undefined property: stdClass::$filemime in theme_file_link() (line 734 of .../modules/file/file.module).
Notice: Undefined property: stdClass::$filesize in theme_file_link() (line 734 of .../modules/file/file.module).
Notice: Undefined property: stdClass::$filename in theme_file_link() (line 740 of .../modules/file/file.module).
Notice: Undefined property: stdClass::$uri in theme_file_link() (line 727 of .../modules/file/file.module).
Notice: Undefined property: stdClass::$filemime in theme_file_icon() (line 765 of .../modules/file/file.module).
Notice: Undefined property: stdClass::$filemime in file_icon_path() (line 809 of .../modules/file/file.module).
Notice: Undefined property: stdClass::$filemime in file_icon_map() (line 852 of .../modules/file/file.module).
Notice: Undefined property: stdClass::$filemime in file_icon_path() (line 824 of .../modules/file/file.module).
Notice: Undefined property: stdClass::$filemime in file_icon_path() (line 824 of .../modules/file/file.module).
Notice: Undefined property: stdClass::$filemime in file_icon_path() (line 824 of .../modules/file/file.module).
Notice: Undefined property: stdClass::$filemime in file_icon_path() (line 824 of .../modules/file/file.module).
Notice: Undefined property: stdClass::$filemime in theme_file_link() (line 734 of .../modules/file/file.module).
Notice: Undefined property: stdClass::$filesize in theme_file_link() (line 734 of .../modules/file/file.module).
Notice: Undefined property: stdClass::$filename in theme_file_link() (line 740 of .../modules/file/file.module).
Notice: Undefined index: und in theme_views_view_galleria() (line 165 of .../sites/all/modules/galleria/theme/theme.inc).

klavs’s picture

Other modules, using the file module, have had similar errors ( http://drupal.org/node/845848 ) - and there it was a missing call to field_attach_submit.. but where that belongs in views.. plugin.inc - I have no idea :(

acrollet’s picture

uploading a patch that rolls in the template change as noted in #8 - I could not reproduce the issue with the optionset object, so have not incorporated the change. Attached patch works for me.

byue’s picture

Hello All:

I have made some changes on the codes, don't know if it is correct. This is to have YouTube preview thumbnail to render with "thumb" imagestyle settings.

elseif ($item['type'] == 'video') {
$data[$delta] = array(
'video' => file_create_url($item['uri']),
'title' => $item['filename'],
);
// Load the YouTube file
$video_file_load = file_load($item['fid']);

// Set up the settings array with your image style
$display['settings'] = array('image_style' => $optionset->imagestyle_thumb);
// Get the render array for the thumbnail image
$youtube_thumb_image = media_youtube_file_formatter_image_view($video_file_load , $display, LANGUAGE_NONE);

// Get the path of the image file of the youtube thumbnail and apply imagestyles
if (empty($optionset->imagestyle_thumb)) {
$data[$delta]['thumb'] = file_create_url($youtube_thumb_image['#path']);
}
else {
$data[$delta]['thumb'] = image_style_url($optionset->imagestyle_thumb, $youtube_thumb_image['#path']);
}

}

It works on well for me as I only use media-youtube. Also the size of the YouTube video should also render at a dimension that is the same as the "full" imagestyle settings, but that's beyond my knowledge.....

Cheers,
byue

Begun’s picture

Issue summary: View changes

I just followed these instructions and wanted to provide the following feedback:

  1. field_layer and field_link fields are not available in the existing field options (only Alt Text and Alt Title fields are available). If I manually create the field_layer and field_link fields, they are not recognized when setting the link and layer options in the Galleria field display options.
  2. Encountered an internal server error when opening the media browser popup (media/browser) to add images/files. Luckily this can be solved by using the latest dev version of media_youtube module.
  3. It is not possible to play the youtube video from within the lightbox popup as the left and right navigation arrows prevent the user from clicking directly on the youtube video. This can be resolved by reducing the width of the .galleria-image-nav-right and .galleria-image-nav-right elements using CSS.
  4. Related to #3 in this list, the youtube videos when clicked will play in fullscreen mode. When this happens it is no longer possible to return to or close the lightbox popup or get back to the galleria page as the youtube layer is placed over the top of other page elements (even those with a higher z-index such as nav buttons. Tested with both Chrome and Firefox (actually using Iceweasel browser). Seems to only be a problem in firefox. Hopefully this can be fixed by adding "wmode=transparent" option to the youtube video URL. I am currently investigating which modules/code is responsible for generating the youtube video URL (haven't been able to track it down yet).