Viewing 16 posts - 1 through 16 (of 16 total)
  • Author
    Posts
  • #1343044

    Hi,
    I have a similar question to the thread #1334473. I would like to have the lightbox always open with the thumbnail size “full”. It worked fine with this code but not anymore. `add_filter(“avf_alb_lightbox_image_size”, function($size) {
    $size = “full”;
    return $size;
    }, 10, 2);`
    Do I have to adjust this somehow?
    Thank you.
    Best regards,
    Vera

    #1343071

    Hey Vera,

    Please try using this code:

    add_filter("avf_alb_lightbox_image_size", function($size, $context) {
        $size = "full";
        return $size;
    }, 10, 2);

    Best regards,
    Nikko

    #1343096

    hm Nikko – and if she does not want to specify a context – ( for masonry or slideshow etc.) – her code seems to be ok.
    But my test only influences image lightbox. Even if i try to change it for slideshow by:

    add_filter("avf_alb_lightbox_image_size", function($size, $context) {
        if($context = "avia_slideshow") {
            $size = "full";
        }
        return $size;
    }, 10, 2);

    And also even if i switch off the lightbox responsive option. No change

    it has no effect.

    the old snippet still works for it:

    function change_lightbox_size() {
        return "full";
    }
    add_filter('avf_avia_builder_helper_lightbox_size','change_lightbox_size', 10);

    for masonry i still take:

    function avia_change_masonry_thumbnail_lightbox_image($size){
      return "full";
    }
    add_filter('avf_avia_builder_masonry_lightbox_img_size', 'avia_change_masonry_thumbnail_lightbox_image', 10, 1);
    #1343098

    Hi,
    thanks for your replies.
    The so called “old snippet” proposed from Guenni007 works well. Thank you!
    Best regards,
    Vera

    #1343143

    Hi Vera,

    Great, I’m glad that @guenni007 could help you out :-)

    Please let us know if you should need any further help on the topic or if we can close it.

    Best regards,
    Rikard

    #1343156

    But please Rikard – do check why that filter does not work in that manner.
    my used filter is only mentioned as apply_filters_deprecated f.e. in class-avia-masonry.php and

    #1343459

    Hi,


    @Guenni007

    Syntax error:

    
    if($context = "avia_slideshow") {
    

    should be

    
    if($context == "avia_slideshow") {
    

    That is why it is recommended to write:

    
    if( 'avia_slideshow' == $context ) {
    

    which would throw a syntax error if you use ‘=’ by mistake.

    Best regards,
    Günter

    #1346900

    That’s right – I hadn’t considered that. Thanks Günter.
    But now to the context. I can find it by opening the corresponding alb and searching above for the if( ! class_exists( ‘xyz’ ) )

    but on slideshow i had to look into the avia-shortcode-helpers to find the correct context: avia_slideshow the slideshow.php itself got: avia_sc_slideshow

    with gallery i had no clue to get the right context neither avia_gallery nor avia_sc_gallery works.

    So how to determine the right context.
    For gallery images i had to take nikos code without context to work as expected.

    • This reply was modified 2 years, 5 months ago by Guenni007.
    #1346971

    Hi,


    @Guenni007

    For the gallery if you look into gallery.php for the filter:

    
    $lightbox_img_size = apply_filters( 'avf_alb_lightbox_image_size', 'large', $this->config['shortcode'], $atts, $content );
    

    it is

    
    $this->config['shortcode'] = 'av_gallery'
    

    This rule should follow in other shortcodes also.

    Best regards,
    Günter

    #1347075

    thanks – so i had to look inside the function: function shortcode_insert_button() for shortcode!
    But then it is for slideshow: av_slideshow ? Please test the snippet yourself – on my end this will not work under 4.9.2.1
    This clarifies the question – but still not solved ? …

    #1347112

    Hi,

    Checking Enfold for the filter:

    
    $lightbox_img_size = apply_filters( 'avf_alb_lightbox_image_size', 'large', $this->config['shortcode'], $atts, $content );
    

    is used in context of:

    ‘av_gallery’
    ‘av_horizontal_gallery’

    For masonry elements (class-avia-masonry.php):

    
    $lightbox_img_size = apply_filters( 'avf_alb_lightbox_image_size', $lightbox_img_size, 'avia_masonry', $entry, $this->config );
    

    For slideshow elements (class-avia-slideshow.php):

    
    $this->config['lightbox_size'] = apply_filters( 'avf_alb_lightbox_image_size', $this->config['lightbox_size'], 'avia_slideshow', $this->config, '' );
    

    It might need to extend the filter function and check the additional parameters of the filter if you need more control.

    Best regards,
    Günter

    #1347119

    yes with gallery it works this way – but on Ismaels link ( besides the == ) for slideshow it does not work.

    #1347391

    Hi there,

    I have to come back to the problem in context with a gallery (only first image shown and other images via lightbox). Here I tried Guenni’s “old version” which had no effect:

    function change_lightbox_size() {
        return "full";
    }
    add_filter('avf_avia_builder_helper_lightbox_size','change_lightbox_size', 10);

    Thank you for suggestions.
    Best regards,
    Vera

    #1347778

    Hi Vera,

    Sorry for the late reply.

    Please check this:

    https://github.com/KriesiMedia/enfold-library/blob/master/actions%20and%20filters/Images%20and%20Lightbox/avf_alb_lightbox_image_size.php

    On my install it works.

    Best regards,
    Günter

    #1348195

    Hi Günther,

    thank you. It works!

    Best regards,
    Vera

    #1348210

    Hi,

    Thanks for your feedback.

    Glad we could help you.

    Enjoy the theme and have a great day.

    Feel free to come back when you need further assistance.

    Best regards,
    Günter

Viewing 16 posts - 1 through 16 (of 16 total)
  • The topic ‘Full size image in lightbox’ is closed to new replies.