Site logo

[Resolved] Scale down just a special thumbnail-size in WordPress

Home Forums Support [Resolved] Scale down just a special thumbnail-size in WordPress

Home Forums Support Scale down just a special thumbnail-size in WordPress

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #2104419
    Kathrin

    Maybe you can help me in that case:

    I just have very few images in the portrait-format that are used in my blog posts. They have the following size 426×639 px. When I regenerate all existing thumbnails, I don’t want that for the portrait-format a thumbnail with the size 300×200 px is created, because that is useless. Is there a possibility to exclude the portrait-format from that thumbnail-size and use for it an own size for example 300×450 px. So an image with the size 426×639 px should only scaled down to a thumbnail size of 300×450 px. Is there a way?

    Greetings Kathrin

    #2104672
    Elvin
    Staff
    Customer Support

    hi Kathrin,

    I’m not sure I fully understand what you mean.

    I’ve checked the post-thumbnails of your site and they seem to be using full or large size images.

    By portrait format, do you mean you have a registered image size portrait-format?

    If it’s about scaling down or scaling up a displayed image then that should be possible w/ CSS.

    But it seems like what you meant is for WordPress to conditionally exclude using of a specific registered image size on a specific image’s SRCSET. That requires a filter to change how your post-thumbnail displays.

    Perhaps I’m completely missing what you mean. Can you explain further? Let us know.

    #2104882
    Kathrin

    Hi Elvin, how should I explain that…

    I have used for some images the format 426×639 (on edge), but these are perhaps only 10 images in about 400 blog posts. Now I have to generate a new image size for mobiles, so that on smaller devices a smaller image format is used (696x464px –> 300x200px). But this format doesn’t fit for on edge images (426×639 px). So when I upload a new image or regenerate the existing thumbnails, I just want that images with the format 426×639 px are scaled down to a 300×450 thumbnail and not to a 300x200px thumbnail. They should be excluded from 300×200 🙂 Is there a way to do that?

    Greetings Kathrin

    #2105023
    David
    Staff
    Customer Support

    Hi there,

    No the add_image_size function cannot be used selectively on specific images.

    https://developer.wordpress.org/reference/functions/add_image_size/

    If it is possible it would require custom development which is out of our scope.

    But to note WP will identify a portrait image.
    A thumbnail size that is set to W X H will have its values flipped to H x W.
    So your 300×200 landscape size, will become 200×300 on a portrait image. Not the 200 will be variable based on the original images aspect ratio.

    #2105070
    Kathrin

    Dear David,

    thank you very much for your answer.

    Greetings Kathrin

    #2105092
    David
    Staff
    Customer Support

    You’re welcome

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