hyunsupul / aesop-core

Open-sourced suite of components that empower interactive storytelling in WordPress.
http://aesopstoryengine.com
GNU General Public License v2.0
244 stars 56 forks source link

Gallery component not using thumbnail images #86

Closed erdmenchen closed 10 years ago

erdmenchen commented 10 years ago

I have WordPress Version 3.8.2 running Aesop Story Engine Version 1.0.9. When I insert a gallery component in a post, the images use the full width file. This makes the site loading quite long on many images.

Is it somehow possible to tell the gallery to use thumbnail images instead of the full res images? Lightbox however should still show the full res images...

bearded-avenger commented 10 years ago

which gallery component?

erdmenchen commented 10 years ago

The Gallery is displayed as photoset...do you mean this? I just added the gallery as described in your manual: http://aesopstoryengine.com/help/gallery-component/

bearded-avenger commented 10 years ago

Right, there are 5 different gallery types just wanted to make sure which one to look at.

bearded-avenger commented 10 years ago

It's using the "large" version of the image. This is because the user might have the image 100% width across their content, so the image has to be somewhat of a good size. Large is only 1024px.

What I'll do is put in a filter that will let you change the size as needed. This will be out with 1.1

erdmenchen commented 10 years ago

Perfect! Thank you very much.

bearded-avenger commented 10 years ago

ok this will ship with 1.1

erdmenchen commented 10 years ago

Thank you very much for this update @bearded-avenger ! But I am having trouble on using this setting. Actually I cant find how to use it... If I edit the aesop-story-engine/public/includes/components/component-gallery.php to use for example large, the images of a gallery are still loaded as full size. So when a page is loaded with this image, it loads a full size 2048px width image. But the <img> control is only 700px wide (in my theme). So thats why I want to be able to set a smaller image version for the photoset gallery to use. Wordpress creates the following images sizes for an uploaded image (I have no plugin installed for this):

I want the photoset gallery to use the 1024px version or even smaller. So either I am using this wrong or the new setting is not applied.

Greetings.

erdmenchen commented 10 years ago

It works with the following change: Currently the image source link is build by calling wp_get_attachment_url. This does not support an image size as shown in the documentation. But by calling wp_get_attachment_image_src, the correct size of an image is used for the image source.

bearded-avenger commented 10 years ago

That's correct its a bug will get fixed. Thanks.

bearded-avenger commented 10 years ago

Ok bug fixed. You may need to regenerate thumbnails with a plugin like Regenerate Thumbs. Also, to run a filter to change the size on the photoset gallery would be something like this. This would change the size from 'large' to 'full' on the photoset gallery.

add_filter('aesop_photoset_gallery_size','my_gallery_size');
function my_gallery_size(){
    return 'full';
}