• Resolved Aldo

    (@ab_lu)


    Hi Stefan

    We try to add some additional attributes to the img tag:

    'attributes' => array(
                                'img' => array(
                                      'class'           => 'lazyload img-responsive',
                                      'data-sizes'      => 'auto',
                                      'data-parent-fit' => 'cover'
                                  )
                                )

    Unfortunately we get then the following error:

    <b>Warning</b>:  Illegal string offset 'property' in <b>/Volumes/Data/WEB/HTDOCS/site/web/app/plugins/responsify-wp/includes/img.php</b> on line <b>43</b><br />
    <br />
    <b>Warning</b>:  Illegal string offset 'value' in <b>/Volumes/Data/WEB/HTDOCS/site/web/app/plugins/responsify-wp/includes/img.php</b> on line <b>43</b><br />
    <br />
    <b>Warning</b>:  Illegal string offset 'property' in <b>/Volumes/Data/WEB/HTDOCS/site/web/app/plugins/responsify-wp/includes/img.php</b> on line <b>43</b><br />
    <br />
    <b>Warning</b>:  Illegal string offset 'value' in <b>/Volumes/Data/WEB/HTDOCS/site/web/app/plugins/responsify-wp/includes/img.php</b> on line <b>43</b><br />

    Any idea?

    https://ww.wp.xz.cn/plugins/responsify-wp/

Viewing 4 replies - 16 through 19 (of 19 total)
  • Plugin Author stefanledin

    (@stefanledin)

    No, it’s a regular image size and WordPress doesn’t add the name of it to the filename.
    If you turn on the debug mode, you’ll see exactly which image sizes that’s being used.

    Thread Starter Aldo

    (@ab_lu)

    Ok. But why are they added twice?
    This is unnecessary code, not?

    Plugin Author stefanledin

    (@stefanledin)

    They isn’t added twice, but since both image-xs@2x and image-md is exactly the same, it appears to be the same images.

    add_image_size( 'image-xs', 385, 9999 );
    Webseite_Mood-385x261.jpg 385w,
    
    add_image_size( 'image-xs@2x', 770, 9999 );
    Webseite_Mood-770x522.jpg 770w,
    
    add_image_size( 'image-sm', 500, 9999 );
    Webseite_Mood-500x339.jpg 500w,
    
    add_image_size( 'image-sm@2x', 1000, 9999 );
    Webseite_Mood-1000x678.jpg 1000w,
    
    add_image_size( 'image-md', 770, 9999 );
    Webseite_Mood-770x522.jpg 770w,
    
    add_image_size( 'image-md@2x', 1540, 9999 );
    Webseite_Mood-1540x1045.jpg 1540w,
    
    add_image_size( 'image-lg', 1000, 9999 );
    Webseite_Mood-1000x678.jpg 1000w,
    
    add_image_size( 'image-lg@2x', 2000, 9999 );
    Webseite_Mood-2000x1357.jpg 2000w,
    
    add_image_size( 'image-xlg', 1540, 9999 );
    Webseite_Mood-1540x1045.jpg 1540w

    Since you have retina sizes that are equal to larger, “regular” sizes, you can turn off retina when using rwp_img().

    Thread Starter Aldo

    (@ab_lu)

    Great, thanks!

Viewing 4 replies - 16 through 19 (of 19 total)

The topic ‘Error when adding additional attributes’ is closed to new replies.