Forum Replies Created

Viewing 15 replies - 1 through 15 (of 22 total)
  • Thread Starter APTM

    (@antonputtemans)

    Now I get a problem in Safari… it turns out the lazySizes Object is undefined, if you use one of it’s Methods, it will break the script!!

    In Firefox the Object is defined, calling the window.lazySizes.loader.unveil() Method works, but seems to skip some images in my case (mostly at the end of the page.

    This works for me moving the image node from the noscript tag and replacing the lazy image but in Safari it won’t load lazy iFrames.

    var lz_Obj = window.lazySizes;
    console.log('window.lazySizes TYPE: ' + typeof lz_Obj, lz_Obj);
    var lz_is_Obj = (typeof lz_Obj !== 'undefined') ? true : false;
    // get all images with .lazyload class ()
    var lz_images = document.querySelectorAll('img.lazyload');
    console.log(lz_images);
    for (let i = 0; i < lz_images.length; i++) {
    	let image = lz_images[i];
    	// console.log('unveil: ' + i, image);
    	// try official lazySizes Method first
    	if (lz_is_Obj) lz_Obj.loader.unveil(image);
    	// hack to get remaining images
    	let noscriptImg = image.nextElementSibling.firstChild;
    	let noscriptImgTxtCont = noscriptImg.textContent;		
    	image.parentNode.innerHTML = noscriptImgTxtCont;
    }
    Thread Starter APTM

    (@antonputtemans)

    OK I had problems with iframes with the lazyload class, so just for the record:

    var lz_Obj = window.lazySizes;
    var lz_images = document.querySelectorAll('img.lazyload');
    // console.log(lz_images);
    for (let i = 0; i < lz_images.length; i++) {
    	let image = lz_images[i];
    	// try official lazySizes Method first
    	lz_Obj.loader.unveil(image);
    	// console.log('unveil: ' + i, image);
    	// hack to get remaining images
    	let noscriptImg = image.nextElementSibling.firstChild;
    	let noscriptImgTxtCont = noscriptImg.textContent;		
    	image.parentNode.innerHTML = noscriptImgTxtCont;
    }
    Thread Starter APTM

    (@antonputtemans)

    I hacked my own unveil Method, replacing the image node with the image textcontent from the noscript tag. Works perfectly for me..

    var images = document.getElementsByClassName('lazyload');
    // console.log(images);
    for (var i = 0; i < images.length; i++) {
    	var image = images[i];
    	// console.log('unveil: ', image);
    	var noscriptImgTag = image.nextElementSibling.firstChild;
    	var noscriptImgTxtCont = noscriptImgTag.textContent;		
    	image.parentNode.innerHTML = noscriptImgTxtCont;
    	i--;
    }
    Thread Starter APTM

    (@antonputtemans)

    Sorry but I don’t get it… The method is right there in the lazySizes Object of your plugin.

    window.lazySizes.loader.unveil() and window.lazySizes.loader.checkElements()

    You are the developer right? I don’t understand why you can not help me… Farkas lazysizes.js v5.3.2 is exactly the same than yours lazysizes.js v5.3 (apart from some deleted comments)

    Why don’t I have access to this Method?

    • This reply was modified 1 year, 9 months ago by APTM.
    Thread Starter APTM

    (@antonputtemans)

    OK, I tried injecting following script at the lazysizes examples webpage on Github https://afarkas.github.io/lazysizes/index.html

    var lazyObj = window.lazySizes;
    var images = document.getElementsByClassName('lazyload');
    for (var i = 0; i < images.length; i++) {
    	lazyObj.loader.unveil(images[i]);
    }

    As expected, all the images outside the viewport are loaded and shown.

    If I do the same here, the images do NOT load… https://tinyurl.com/y5pstmxj

    • This reply was modified 1 year, 9 months ago by APTM.
    • This reply was modified 1 year, 9 months ago by APTM.
    Thread Starter APTM

    (@antonputtemans)

    I found that the lazySizes is loaded in the window.

    var lazyObj = window.lazySizes;
    console.log('window.lazySizes Object:' + JSON.stringify(lazyObj));

    gives me this:

    window.lazySizes Object:{"cfg":{"expand":1000,"lazyClass":"lazyload","loadedClass":"lazyloaded","loadingClass":"lazyloading","preloadClass":"lazypreload","errorClass":"lazyerror","autosizesClass":"lazyautosizes","fastLoadedClass":"ls-is-cached","iframeLoadMode":0,"srcAttr":"data-src","srcsetAttr":"data-srcset","sizesAttr":"data-sizes","minSize":40,"customMedia":{},"init":true,"expFactor":1.5,"hFac":0.8,"loadMode":3,"loadHidden":true,"ricTimeout":0,"throttleDelay":125},"autoSizer":{},"loader":{},"elements":{"0":{},"1":{},"2":{},"3":{},"4":{},"5":{},"6":{},"7":{},"8":{},"9":{},"10":{},"11":{},"12":{},"13":{},"14":{},"15":{},"16":{},"17":{},"18":{},"19":{},"20":{},"21":{},"22":{},"23":{},"24":{},"25":{}},"_defEx":1000}

    I had a look at the Methods here: https://github.com/aFarkas/lazysizes#js-api—methods

    but can’t get it to show all images outside the viewport… in Safari using the “Export as PDF…” the images are not loaded.

    var lazyObj = window.lazySizes;
    var images = document.getElementsByTagName('img'); 
    for (var i = 0; i < images.length; i++) {
        lazyObj.loader.unveil(images[i]);
    }

    Any help would be appreciated!

    • This reply was modified 1 year, 9 months ago by APTM.
    Thread Starter APTM

    (@antonputtemans)

    Thanks for the help.
    I could have thought about deactivating plugins…
    Anyway, it was WordFence:

    This query string is from the option “Hide WordPress version” — it replaces the original “ver=” string that already appears on the static content. If you uncheck that box, you will see the original version numbers instead, without any changes from Wordfence.

    It shouldn’t affect any pageload scores, since it is only replacing a version string that already exists, but may affect browser caching if you need query strings to change to cause an asset to expire. In an upcoming version of Wordfence, this part of the query string will only be replaced if the “ver=” string matches the WordPress version, so it will not hide the original version string of other assets.

    APTM

    (@antonputtemans)

    No you are wrong.
    You can not use media queries or image sets with img elements.
    Only CSS background images – that’s why image sprites with queries would be the only way to do your icons

    Have you tested your icons on both retina and non retina displays?
    I have an older MBP and a simple test with javascript
    alert('Device Pixel Ratio: ' + window.devicePixelRatio);
    shows that I have a devicePixelRatio of 1
    Now in Crome when I rightclick and icon and > inspect image
    it shows the icon is 48×48 downscaled to 24×24

    APTM

    (@antonputtemans)

    I was shocked to find out the plugin uses double resolutions scaled down to 50% to support the retina display hype.

    Developer please read:
    https://developer.apple.com/library/safari/documentation/NetworkingInternet/Conceptual/SafariImageDeliveryBestPractices/ServingImagestoRetinaDisplays/ServingImagestoRetinaDisplays.html

    And while we’re at it.. why don’t you use sprites in the first place?
    Sprites with the Image Sets or Media Queries in CSS would be the only right way before claiming your plugin is the only one to support retina displays….

    Thread Starter APTM

    (@antonputtemans)

    Hi and thank you for the fast reply!

    You are completely right about just trying.
    As a matter of fact I just did a few tests with a photo of foliage with white text on top and your plugin gives remarkable results indeed.
    I was able to shave about 20% off the filesize, pulling down the jpeg quality to 75% and STILL have an image that looks way better than WP’s 90% jpeg quality.

    It’s unbelievable that WP does not seem to apply any unsharp mask.
    This is vital for small thumbnails!

    I believe you should try and find an algorithm to control your sharpening matrix on a scale from 1 to 10, that would be really cool.

    And btw, you are right about Imagick, I compared WP’s 90% default against a GD version and quality wise don’t see any difference. Only the filesize of Imagick’s was bigger.
    So what’s all the fuss than about WP 3.5 prefers Imagick and should be superior??

    APTM

    (@antonputtemans)

    I have 3 fsg_photobox’es on one page and no problem they load only the images from their box, not all of them?

    APTM

    (@antonputtemans)

    This is a concern indeed.
    I just checked out with the developer tools in Chrome and there are no title or alt attributes in the image tag
    <div style="width: 121px; height: 121px; top: 250px; left: 500px; margin: 2px;"><a data-postid="fsg_photobox_1" data-imgid="52" href="WPtest/wp-content/uploads/2014/03/00078.jpg"><img style="left: 0px; top: 0px;" width="121" height="121" src="WPtest/wp-content/uploads/2014/03/00078-150x150.jpg"></a></div>

    When you say that WP makes attachment pages for every image and can index them that way shouldn’t it be better to link to that page than instead of the original image?

    I also hear that those attachment pages are bad for SEO, but I still need to wrap my head around why so.

    Thread Starter APTM

    (@antonputtemans)

    OK nevermind I just found the hook:

    <?php echo do_shortcode('[fsg_photobox include="57,55,56,54,53,52,51,50" rows="1" cols="7" repeat="false"]') ?>

    Thread Starter APTM

    (@antonputtemans)

    OK I did some more testing and it looks like I was wrong about the scaling.
    Apparently your plugin serves image versions based on the WP >media >settings.

    But loading all the images at once is not acceptable.
    Do you plan on fixing this?

    I do have to compliment you on the tiled images, good job.
    When using the original JP tiled images these are loaded from a WP server which processes your original images. No Good..

    Thread Starter APTM

    (@antonputtemans)

    Thanks Meitar, but I just wanted to rewrite the URI.

    Anyway in a response to Iridiax, as I am going the way of an external page importing importing wp-blog-header.php
    I just found you can send the redirect dir to fix my problem in
    https://www.ads-software.com/support/topic/229621#post-941167

    All it takes is adding to the form:
    <input type=”hidden” name=”redirect_to” value=”../about/” />

    Thanks all, this topic is resolved.. kinda

Viewing 15 replies - 1 through 15 (of 22 total)