no resized image for certain class
-
hey lay team,
id like for a zoom-function that all imgs with .zoooom class are displayed in the original size and not resized
i used this snippet:
add_filter('wp_get_attachment_image_src', function($image, $attachment_id, $size, $icon) {
if (isset($GLOBALS['zooom_force_full_image']) && $GLOBALS['zooom_force_full_image'] === true) { $full = wp_get_attachment_image_src($attachment_id, 'full'); return $full ?: $image; } return $image;}, 10, 4);
add_filter('wp_get_attachment_image_attributes', function($attr, $attachment, $size) {
if (isset($attr['class']) && strpos($attr['class'], 'zooom') !== false) { $GLOBALS['zooom_force_full_image'] = true; } else { $GLOBALS['zooom_force_full_image'] = false; } return $attr;}, 10, 3);
--
and it works fine on desktop - but not on mobile
do you have an idea what i could do about it?
thank you!
-
K kooloo referenced this topic on
-
id like for a zoom-function that all imgs with .zoooom class are displayed in the original size and not resized
what do you mean with not resized?
ah, you mean it should show the full source.
so the issue is you're trying to zoom in on images in mobile and then your image gets blurry?
-
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login