• Resolved Jean-Philippe

    (@teucrium)


    Hello,

    Thanks a lot for the plugin you’ve made. It does a great job and it’s exactly what I’m looking for.

    The only problem I have is about the lack of attribute in the output : for example, when using your plugin on a post, i get :

    <div data-zoom="https://www.example.com/medias/image.jpg" class="zoom"><img src="https://www.example.com/medias/image.jpg"></div>

    I would like to get instead a complete html code with width, height, and alt :

    <div data-zoom="https://www.example.com/medias/image.jpg" class="zoom"><img src="https://www.example.com/medias/image.jpg" width="800" height="600" alt="my alternative text"></div>

    Is it something possible ? Is it a feature you plan to add ?

    EDIT :
    For example, based on the code of your plugin, I’ve modified the line 130 of the feature-image-zoom.php file, adding this little piece of code alt=”‘ . $image_alt . ‘”, and now I’m getting the alt attribute with the appropriate content inside :

    $zoomfeature = '<div data-zoom="' . $full_zoom_image_url[0] . '" class="' . $class . '"><img src="' . $large_zoom_image_url[0] . '" alt="' . $image_alt . '"></div>';

    I’m sure it would be pretty easy to improve your plugin but i’m not sure i’m advanced enough to do it myself.

    Best regards,
    J.

    • This topic was modified 4 years, 10 months ago by Jean-Philippe.
    • This topic was modified 4 years, 10 months ago by Jean-Philippe.
    • This topic was modified 4 years, 10 months ago by Jean-Philippe.
Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author cubecolour

    (@numeeja)

    There are no current plans to add features to the plugin, and that is only likely to change if I need additional features for my own projects or if adding a new feature is commissioned as a client job.

    You should be able to change the size of the image by including it within a div with a fixed size, or it can be targetted with css rules, eg:

    .zoom {
    	width: 300px;
    }

    A height should not be specified to ensure the aspect ratio is preserved.

    Thread Starter Jean-Philippe

    (@teucrium)

    Thanks for your quick answer.

    I needed to add width and height attributes to improve page load time and performance (it is recommended to display the width and height attributes of the img tag directly inside the html).

    What if I try to contribute to the code of your plugin (like the alt attribute i’ve added as you can see in the edit of my previous post) ? Do you want me to submit it to you if my code does the job ?

    • This reply was modified 4 years, 10 months ago by Jean-Philippe.
    Thread Starter Jean-Philippe

    (@teucrium)

    Ps :
    If i use your function in my theme, like this, I dont get the expected code.
    For example, if i use :

    <?php if ( function_exists('cc_zoom_featured_image') ) {
      echo cc_zoom_featured_image(array(
        'size' =>; 'thumbnail',
        'zoomsize'=>'full',
      ));
    }
    ?>

    I get :

    <div data-zoom="https://localhost/site/medias/image.jpg" class="zoom"><img width="3650" height="2566" src="https://localhost/site/medias/image.jpg" alt="Arnold Bocklin, A la lisière du bois" /></div>

    But if I use :

    <?php if ( function_exists('cc_zoom_featured_image') ) {
      echo cc_zoom_featured_image(array(
        'size' => 'large',
        'zoomsize'=>;'medium',
      ));
    }
    ?>

    I get :

    <div data-zoom="https://localhost/site/medias/image.jpg-300x211.jpg" class="zoom"><img width="3650" height="2566" src="https://localhost/site/medias/image-1024x720.jpg" alt="Arnold Bocklin, A la lisière du bois" /></div>

    Why ? There is something I dont understand : logically, I would expect to obtain a data-zoom image bigger (this is the one I use to zoom right ?) than the image inside the img tag (which is the image displayed).

    Thanks in advance !
    J.

    • This reply was modified 4 years, 10 months ago by Jean-Philippe.
    Plugin Author cubecolour

    (@numeeja)

    It is not within the scope of the free support I can provide here to help with troubleshooting issues that oocur on a modifed version of the plugin.

    Thread Starter Jean-Philippe

    (@teucrium)

    I understand. Thanks for your time. I will use another solution then. Hope one day you will improve this little plugin because it could really have a bright future. Keep it light, easy-to-use. Thanks again ??

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Adding width and height to the output’ is closed to new replies.