• Resolved Henry

    (@henrybaum)


    When setting an image size smaller than the image, the image displays the entire image in those dimensions, so the thumbnail becomes distorted. For instance, I want to show only a part of an image with a height 300 width 200 – setting the thumbnail to 75 height 100 width.

    Is it possible to crop a portion of the image instead of showing the entire image in the thumbnail?

Viewing 1 replies (of 1 total)
  • Plugin Author Martin Stehle

    (@hinjiriyo)

    Yes, that is possible. It needs some PHP skills in three steps. Lets call the new image size ‘rpwwt-thumbnail’:

    1. In the file ‘functions.php’ of your theme look for the setup routine add there the function add_image_size() [1]. For example
      add_image_size( 'rpwwt-thumbnail', 100, 75, true );

      The last argument has to be true to switch on cropping. Save the file.

    2. Install, activate and run once the plugin ‘Regenerate thumbnails’ [2] to let write images in the new dimension. After that you can deinstall it.
    3. Go to the Widgets page and in the RPWWT widget select ‘rpwwt-thumbnail’ from the image dimensions list. Save the settings and you are done.

    [1] https://developer.www.ads-software.com/reference/functions/add_image_size/
    [2] https://www.ads-software.com/plugins/regenerate-thumbnails/

    • This reply was modified 7 years, 1 month ago by Martin Stehle. Reason: Added formatting
Viewing 1 replies (of 1 total)
  • The topic ‘Images Stretched’ is closed to new replies.