Removing 2100px size limit on photos

Mauer Themes Support Stills Removing 2100px size limit on photos

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #3819
    suchyy
    Participant

    Hi,
    I added my question in another thread but I see that you replied to a new thread yesterday and not to my question there, so I am also making a new one for more visibility.

    I would like the photos I upload to be displayed in their original size when viewed in the Lightbox. I would like to utilise the 4k/5k screens and I already compress the photos to the levels I want using ImageOptim and JpegMini.

    Thanks!
    Jakub

    #3874
    Paul
    Keymaster

    Hi Jakub,

    Not an easy one here. But I have a solution finally.

    The best way to implement this customisation is to create a child theme. Or you can just make these changes each time after you update a theme.

    First, please go to js/general.js in the theme folder and add the following code just before the $(document).ready(function() { call:

    function customJakubPswpTargetSubstitute() {
    	$('.mauer-stills-gallery-pswp-big-img-link').each(function(i,el){
    		var imgFullUrl = $(this).find('img.mauer-stills-gallery-pswp-img').data('imgFullUrl');
    		$(this).attr('href', imgFullUrl);
    	});
    }

    Then add the following line of code at the end of the $(window).load(function(){ block.

    customJakubPswpTargetSubstitute();

    So the result should look like this: see screenshot. The added code is highlighted.

    Then to make this script be updated in your and your users’ browser cache please go to style.css in the theme folder and change the theme version in the header. Currently, it is 1.3.3. Change it to, let’s say, 1.3.3j.

    And finally, to future proof the solution you may want to take care of WP having introduced a limit on max image dimensions starting from WP version 5.3. See “Introducing handling of big images in WordPress 5.3” for details.

    To take care of this, please go to the functions.php file in the theme folder and add the following line:
    add_filter( 'big_image_size_threshold', '__return_false' );

    Sorry for the late reply. It’s not a trivial customization. Also, please mind that customizations are not part of the support according to ThemeForest rules.

    Kind regards,
    Paul

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.