Fix image not rendering on the editor and empty styles (https://github.com/woocommerce/woocommerce-blocks/pull/10089)
This commit is contained in:
parent
d6037a2efb
commit
25a5737ec7
|
@ -60,8 +60,6 @@
|
|||
|
||||
.wc-block-components-product-image {
|
||||
margin: 0 0 $gap-small;
|
||||
position: relative;
|
||||
z-index: -1;
|
||||
}
|
||||
|
||||
.wc-block-product-image__tools-panel .components-input-control {
|
||||
|
|
|
@ -148,7 +148,16 @@ class ProductImage extends AbstractBlock {
|
|||
private function render_image( $product, $attributes ) {
|
||||
$image_size = 'single' === $attributes['imageSizing'] ? 'woocommerce_single' : 'woocommerce_thumbnail';
|
||||
|
||||
$image_style = sprintf( 'max-width:none; height:%s; width:%s; object-fit:%s;', $attributes['height'] ?? '', $attributes['width'] ?? '', $attributes['scale'] ?? '' );
|
||||
$image_style = 'max-width:none;';
|
||||
if ( ! empty( $attributes['height'] ) ) {
|
||||
$image_style .= sprintf( 'height:%s;', $attributes['height'] );
|
||||
}
|
||||
if ( ! empty( $attributes['width'] ) ) {
|
||||
$image_style .= sprintf( 'width:%s;', $attributes['width'] );
|
||||
}
|
||||
if ( ! empty( $attributes['scale'] ) ) {
|
||||
$image_style .= sprintf( 'object-fit:%s;', $attributes['scale'] );
|
||||
}
|
||||
|
||||
if ( ! $product->get_image_id() ) {
|
||||
// The alt text is left empty on purpose, as it's considered a decorative image.
|
||||
|
|
Loading…
Reference in New Issue