- This topic has 5 replies, 3 voices, and was last updated 3 years, 7 months ago by
David.
-
AuthorPosts
-
February 3, 2022 at 2:04 pm #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
February 3, 2022 at 9:45 pm #2104672Elvin
StaffCustomer Supporthi 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.
February 4, 2022 at 3:26 am #2104882Kathrin
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
February 4, 2022 at 5:54 am #2105023David
StaffCustomer SupportHi 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.February 4, 2022 at 6:51 am #2105070Kathrin
Dear David,
thank you very much for your answer.
Greetings Kathrin
February 4, 2022 at 7:05 am #2105092David
StaffCustomer SupportYou’re welcome
-
AuthorPosts
- You must be logged in to reply to this topic.