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
-
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?
I also code custom websites or custom Lay features.
šæ Email me here: šæ
info@laytheme.com
Our Web Development company: 100k.studio
Want to tip me? https://www.paypal.com/paypalme/arminunruh
Before you post:
- When using a WordPress Cache plugin, disable it or clear your cache.
- Update Lay Theme and all Lay Theme Addons
- Disable all Plugins
- Go to Lay Options ā Custom CSS & HTML, click "Turn Off All Custom Code", click "Save Changes"
This often solves issues you might run into
When you post:
- Post a link to where the problem is
- Does the problem happen on Chrome, Firefox, Safari or iPhone or Android?
- If the problem is difficult to explain, post screenshots / link to a video to explain it