[wordpress插件] Custom Image Sizes自定义图像尺寸

wordpress 插件 文章 2020-04-08 11:40 532 0 全屏看文

AI助手支持GPT4.0

评分
100
描述

Custom Image Sizes is a WordPress plugin that

自定义图像大小是一个WordPress插件,

    • generates the correctly-sized version of an image’s thumbnail, if it doesn’t already exist.
    • 生成正确大小的图像缩略图(如果尚不存在)。

    • lets you specify custom sizes with a size parameter of '[width]x[height]'.
    • 让您指定尺寸为'[width] x [height]'的自定义尺寸。

    Read more at the Custom Image Sizes page.

    自定义图像尺寸页面上了解更多。

    p>

    >

    Usage

    用法

    The typical WordPress way

    典型的WordPress方式

      • Put add_image_size( 'my_custom_thumbnail_name', 220, 130, true ); in your theme’s functions.php file.
      • add_image_size('my_custom_thumbnail_name',220,130,true); 放入主题的functions.php文件中。

      • Add the code to display that attachment’s thumbnail where you want it to appear: echo wp_get_attachment_image($attachment_id, 'my_custom_thumbnail_name');
      • 添加代码以将附件的缩略图显示在您希望显示的位置: echo wp_get_attachment_image($ attachment_id,'my_custom_thumbnail_name');

      • Unlike WordPress by itself, Custom Image Sizes will generate the thumbnail for an image, even if the image was uploaded before this add_image_size() was set.
      • 与WordPress本身不同,即使在设置 add_image_size()之前上传图片,“自定义图片大小”也会生成图片的缩略图。

      A more direct Custom Image Sizes way

      更直接的“自定义图像尺寸”方式

        • Call wp_get_attachment_image_src() or wp_get_attachment_image() with the desired thumbnail '[width]x[height]' dimensions, like so:

          用所需的缩略图'[width] x [height]'尺寸调用 wp_get_attachment_image_src() wp_get_attachment_image(),如下所示:

            echo wp_get_attachment_image($attachment_id, '220x80');  

            echo wp_get_attachment_image($ attachment_id,'220x80');  

          /**   

          / **   

          * The above prints markup like   

          *以上打印标记   

          *

          * “”   <p/

          * class="attachment-220x80" src="http://www.example.com/path-to-file/something-220x80.jpg" />   

          * class =“ attachment-220x80” src =“ http://www.example.com/path-to-file/something-220x80.jpg” />   

          */

          * /

安装步骤

    1. Upload filosofo-custom-image-sizes/ to the /wp-content/plugins/ directory
    2. filosofo-custom-image-sizes / 上载到 / wp-content / plugins / 目录

    3. Activate the plugin through the ‘Plugins’ menu in WordPress
    4. 通过WordPress中的“插件”菜单激活插件

下载地址
https://downloads.wordpress.org/plugin/custom-image-sizes.1.0.zip
-EOF-

AI助手支持GPT4.0


国内超级便宜服务器

摸鱼人热门新闻聚合

钻级赞助商 我要加入

开发者在线工具

第三方支付技术请加QQ群

相关文章
[wordpress插件] Contact Form Generator : Creative form builder for WordPress联系表格生成器:WordPress的创意表格生成器
[wordpress插件] Author Bind作者绑定
[wordpress插件] Content Randomizer内容随机化器
[wordpress插件] Davon’s Floating Admin Bar达文的浮动管理栏
[wordpress插件] All-in-one Like Widget一体式小工具
随便看看
教育科技公司申请微信支付被拒绝? 3855
微信公众号免300认证教程 4952
小程序已经上线,作为管理员无法在小程序数据助手查看数据? 4069
小程序广告组件通过审核,但是小程序内没有显示广告? 4149
企业微信通讯录账号被管理员误/恶意删除,怎么办? 8013
问题? 7249
如何快速搭建抽奖助手小程序(无需代码知识) 5034
许涛 大哥在吗, 要解冻小程序的时候提示信息主体不一致, 能帮忙看下吗? 5987
小程序搜一搜全称搜索不显示 麻烦解决一下!谢谢 5506
我的小程序广告收款主体是个体工商户,每个月邮寄两次发票很是麻烦,我年底的时候打包邮寄一次可以么? 5202