改变放大镜和灯箱图像woocommerce [英] change magnifier and lightbox image woocommerce

查看:142
本文介绍了改变放大镜和灯箱图像woocommerce的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

因为我正在开发一个股票照片网站,我不想图像被盗。
我安装了水印解决方案,除了全尺寸外,所有产品图像都带有水印。购买后即可下载。

as I'm developing a stock photo site I don't want image theft. I have a watermark solution installed and all product images are watermarked except for the full size. This is the one for download after a purchase.

现在,默认的WooCommerce行为是当我将鼠标悬停在单个产品页面上的显示图像上时,会启动放大镜。好的,但没有我的水印显示全尺寸图像。即便如此,单击图像时,灯箱会打开,显示完整尺寸的图像。

The default WooCommerce behavior is now that when I hover over the displayed image on the single product page the magnifier is launched. Ok, but the full size image is displayed without my watermark. Even so when the image is clicked the lightbox open displaying the full size image.

当用户希望他检查元素时,复制网址并下载完整尺寸的图像而不购买。这是一个不受欢迎的情况。

When a user want he kan inspect the element, copy the url and download the full size image without buying. That's an unwanted situation.

有人知道如何在放大镜和灯箱中显示水印(较大)的预览吗?我自己无法找到它。

Does someone knows how to show a watermarked (larger) preview in the magnifier and lightbox? I was not able to find it myself.

祝福

推荐答案

找到它。
只需添加另一个名为preview的缩略图大小。所以我在我的functions.php文件中添加了这行代码:

Found it. Just add another thumbnail size called preview. So I added this line of code in my functions.php file:

add_image_size( 'preview', $width = 3072, $height =3072, $crop = false );

并更改

$thumbnail_size    = apply_filters( 'woocommerce_product_thumbnails_large_size', 'large' );

$thumbnail_size    = apply_filters( 'woocommerce_product_thumbnails_large_size', 'preview' );

不要忘记将product-image.php模板文件复制到您的子主题。

Don't forget to copy the product-image.php template file to your child theme.

这篇关于改变放大镜和灯箱图像woocommerce的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆