soflyy / oxygen-bugs-and-features

Bug Reports & Feature Requests for Oxygen
https://oxygenbuilder.com/
314 stars 29 forks source link

Image fields within MetaBox cloneable groups are only shown in Thumbnail Size #2922

Open EDGFX opened 2 years ago

EDGFX commented 2 years ago

Describe the bug I have a custom post type that houses different "tools" such as Calculators, Brochures, etc. Within each of these "tool" categories, there is a cloneable Group field that houses tool name, image (advanced), URLs, etc. Here is what the MetaBox structure looks like:

image

Here is what a post in this CPT looks like:

image

The issue I'm having is that the "Individual Tools" images are being shown in 150x150 image modules on the front-end despite the actual image dimensions being about 430x250:

image

I've submitted a forum post in the MetaBox forums and this is what I was told:

image

Provide the link to a Sandbox install where the issue is present. If the issue only exists on a specific post or template, provide a direct link to that post or template.

https://wordpress-313797-2433525.cloudwaysapps.com/austin/tools/calculators/

IF YOU CAN'T PROVIDE A SANDBOX REPRODUCTION: Steps required to reproduce the bug: Steps to reproduce the behavior:

  1. Create new CPT.
  2. Create new Custom Fields for the CPT. Add a text field, and then add a group field and set it to cloneable and sortable. Within the group field, add something simple like a text field, and an image advanced field.
  3. Create a new post in the created CPT, and add relevant content as well as an image to the image advanced field(s) within the group.
  4. Create a new page and use a Repeater to pull the text and image from within the Group field into relevant on-page content. Save and view on front-end.
dmlinaric commented 2 years ago

+1

EDGFX commented 2 years ago

This issue is singlehandedly holding up a site deployment. Hoping we can get some insight on this soon. If anyone knows of any workarounds, that would be awesome.

EDGFX commented 2 years ago

Here is a fix that was offered to me by Oxygen Support that helped solve the issue:

image

Simply replace tool_image with the ID of the image field you're pulling from.

GloryANT commented 2 years ago

workaround worked for me, thanks EDGFX!

Code:

<?php
global $meta_box_current_group_fields;
$image_src = wp_get_attachment_image_src($meta_box_current_group_fields['tool_image'][0], "full")[0];
?>
<img class="mb-image__img" src="<?= $image_src;?>">
EDGFX commented 2 years ago

Made a video for the temporary fix mentioned in this post:

https://www.youtube.com/watch?v=1rCbbI1jQbQ

dmlinaric commented 2 years ago

For Single Image type use this code:

<?php
global $meta_box_current_group_fields;
$image_src = wp_get_attachment_image_src($meta_box_current_group_fields['tool_image'], "full")[0];
?>
<img class="mb-image__img" src="<?= $image_src;?>">