人工制造 / smart-media
HM Cloud 的智能媒体功能
0.5.4
2024-04-22 12:40 UTC
- dev-master
- 0.5.4
- 0.5.3
- 0.5.2
- 0.5.1
- 0.5.0
- 0.4.6
- 0.4.5
- 0.4.4
- 0.4.3
- 0.4.2
- 0.4.1
- 0.4.0
- 0.3.16
- 0.3.15
- 0.3.14
- 0.3.13
- 0.3.12
- 0.3.11
- 0.3.10
- 0.3.9
- 0.3.8
- 0.3.7
- 0.3.6
- 0.3.5
- 0.3.4
- 0.3.3
- 0.3.2
- 0.3.1
- 0.3.0
- 0.2.23
- 0.2.22
- 0.2.21
- 0.2.20
- 0.2.19
- 0.2.18
- 0.2.17
- 0.2.16
- 0.2.15
- 0.2.14
- 0.2.13
- 0.2.12
- 0.2.11
- 0.2.10
- 0.2.9
- 0.2.8
- 0.2.7
- 0.2.6
- 0.2.5
- 0.2.4
- 0.2.3
- 0.2.2
- 0.2.1
- 0.2.0
- 0.1.16
- 0.1.15
- 0.1.14
- 0.1.13
- 0.1.12
- 0.1.11
- 0.1.10
- 0.1.9
- 0.1.8
- dev-dependabot/npm_and_yarn/express-4.21.0
- dev-dependabot/npm_and_yarn/webpack-5.94.0
- dev-dependabot/npm_and_yarn/multi-d1d84b812c
- dev-gh-actions
- dev-srcset-crop-output-bug
- dev-dependabot/npm_and_yarn/webpack-dev-middleware-and-webpack-dev-server--removed
- dev-dependabot/npm_and_yarn/follow-redirects-1.15.6
- dev-dependabot/npm_and_yarn/tar-and-node-sass-6.2.0
- dev-dependabot/npm_and_yarn/babel/traverse-7.23.2
- dev-dependabot/npm_and_yarn/postcss-and-css-loader-8.4.31
- dev-v0-4-branch
- dev-v0-3-branch
- dev-0.3.12--branch
- dev-0.4.1--branch
- dev-0.3.11--branch
- dev-backport-158-to-v0-3-branch
- dev-0.3.10--branch
- dev-0.3.9--branch
- dev-0.3.8--branch
- dev-0.3.7--branch
- dev-0.3.6--branch
- dev-0.3.5--branch
- dev-0.3.4--branch
- dev-0.3.3--branch
- dev-release-0-3-3
- dev-0.3.2--branch
- dev-0.3.1--branch
- dev-v0-2-branch
- dev-0.2.22--branch
- dev-0.2.21--branch
- dev-0.2.20--branch
- dev-0.2.19--branch
- dev-0.2.18--branch
- dev-0.2.17--branch
- dev-0.2.16--branch
- dev-fix-feature-image-selection
- dev-0.2.15--branch
- dev-0.2.14--branch
- dev-0.2.13--branch
- dev-0.2.12--branch
- dev-0.2.11--branch
- dev-0.2.10--branch
- dev-0.2.9--branch
- dev-0.2.8--branch
- dev-0.2.7--branch
This package is auto-updated.
Last update: 2024-09-21 06:44:25 UTC
README
为 WordPress 提供更智能的媒体功能。
此插件中的一些功能可以独立运行,但有些功能旨在增强我们使用的现有工具,例如 Tachyon。
功能
对齐媒体库
默认情况下,媒体库显示正方形缩略图,这可能会使查找正确的图像变得困难。此功能使缩略图保持原始的宽高比,类似于 Flickr 的 UI。
要禁用此功能,请添加以下内容
<?php add_filter( 'hm.smart-media.justified-library', '__return_false' );
图片编辑器
此功能覆盖了内置的 WordPress 图片编辑体验,并允许您控制单个缩略图的裁剪。还有一些用户体验改进,意味着进行编辑所需的点击次数更少。
要禁用此功能,请添加以下内容
<?php add_filter( 'hm.smart-media.cropper', '__return_false' );
图片裁剪 UI 提供了对以下过滤器的支持,用于根据当前选择更新 Gutenberg 块属性
smartmedia.cropper.updateBlockAttributesOnSelect.<块名称>
smartmedia.cropper.selectSizeFromBlockAttributes.<块名称>
在上面的过滤器中,<块名称> 应替换为点分隔的块名称版本,例如 core/image
变为 core.image
。默认情况下,核心图片块属性已映射。
将选定的图像映射到块属性
addFilter( 'smartmedia.cropper.updateBlockAttributesOnSelect.core.image', 'smartmedia/cropper/update-block-on-select/core/image', /** * @param {?Object} attributes The filtered block attributes. Return null to bypass updating. * @param {Object} image The image data has the following shape: * { * name: <string>, The image size name * url: <string>, The URL for the sized image * width: <int>, The width in pixels * height: <int>, The height in pixels * label: <string>, The human readable name for the image size, only present for user selectable sizes * cropData: <?object>, Null or object containing x, y, width and height properties * } */ ( attributes, image ) => { // Only user selectable image sizes have a label so return early if this is missing. if ( ! image.label ) { return attributes; } return { sizeSlug: image.size, url: image.url, }; } );
根据选定的块属性更新裁剪 UI 的选定大小
addFilter( 'smartmedia.cropper.selectSizeFromBlockAttributes.core.image', 'smartmedia/cropper/select-size-from-block-attributes/core/image', /** * @param {?String} size The image size slug. * @param {Object} block The currently selected block. */ ( size, block ) => { return size || block.attributes.sizeSlug || 'full'; } );
该函数接受 2 个参数
block
:要映射属性的块名称callback
:一个函数,它接受图像size
名称、包含url
、width
、height
、裁剪数据和图像大小标签的图像对象,以及最后是完整的attachment
数据对象。
回调应返回一个对象或 null
。传递 null
将防止更新当前选定的块。
路线图
计划的功能包括
- 重复图像检测和合并
- EXIF 数据编辑器
贡献
首先,感谢您使用此插件,并感谢您做出贡献!
要开始,请查看 贡献文档。