Linux 软件免费装
Banner图

Crop-Thumbnails

开发者 volkmar-kantor
更新时间 2024年10月27日 06:14
捐献地址: 去捐款
PHP版本: 7.4.0 及以上
WordPress版本: 6.6.2
版权: GPL v3
版权网址: 版权信息

标签

images media library post-thumbnails

下载

1.9.2 1.1.2 1.1.3 1.2.0 1.2.4 1.2.5 1.2.6 1.3.0 1.2.2 1.9.3 1.3.1 1.2.1 1.9.4 1.0.0 1.0.2 1.4.0 1.5.0 1.1.1 1.2.3 1.0.1 1.7.0 1.7.1 1.7.2 1.1.0 1.8.0 1.9.0 1.0.3 1.6.0 1.9.1

详情介绍:

The plugin provides the functionality to adjust the crop region of cropped images. It add buttons to the edit-pages and media-dialog to access a crop-editor. In the crop-editor you can choose one or more (if they have the same ratio) imagesizes and cut-off the part of the image you want. The plugin is especially useful for theme developers who want to keep full control over cropped image sizes. If you want to dive even deeper, you can get informations about the hooks and filters on the github page of the plugin.

安装:

You can use the built in installer and upgrader, or you can install the plugin manually.
  1. You can either use the automatic plugin installer or your FTP program to upload it to your wp-content/plugins directory the top-level folder. Don't just upload all the php files and put them in /wp-content/plugins/.
  2. 通过 WordPress 的“插件”菜单激活插件
  3. Configure any settings from "Settings > Crop-Thumbnails".
  4. Use it.

屏幕截图:

  • Choose one or more images (with the same ratio).
  • The crop-editor is also integrated in the list-view of the media library.
  • Choose what image-sizes should be hidden (for what post-types), for better usability.
  • Quicktest on settings-page, to check if your system is correct setup.

常见问题:

How to define cropped image sizes?

The plugin do not add additional image sizes, it only provides functionality to edit the crop area. You can use "add_image_size" inside your functions.php to add additional cropped image sizes. See "add_image_size" documentation. ` add_action( 'after_setup_theme', 'my_adjust_image_sizes' ); function my_adjust_image_sizes() { //add an cropped image-size with 800 x 250 Pixels add_image_size( 'my-custom-image-size', 800, 250, true ); / * The following image sizes use a dynamic value. * USE WITH CARE * Also the plugin supports these image-sizes, i do not recommend them! / //a dynamic cropped image size with 500 pixel height and the width of the original image add_image_size( 'my-dynamic-width-1', 9999, 500, true ); //a dynamic cropped image with the same ratio as the original image and 500 pixel width add_image_size( 'my-dynamic-zero-height-1', 500, 0, true ); } After you add the image-size any futher image uploads will produce a cropped image "my-custom-image-size" which you can use in post-loop:if ( has_post_thumbnail() ) { the_post_thumbnail( 'my-custom-image-size' ); }`

What internal rules the plugin use for cropping?

  • The plugin will only crop image-sizes where crop is set to "true" (hard crop mode - see: http://codex.wordpress.org/Function_Reference/add_image_size).
  • If you had set one image dimension in add_image_size() to "0", the plugin will crop it in the ratio of the original image.
  • If you had set one image dimension in add_image_size() to "9999", the plugin will change the 9999 to the actual size of the current original image.
  • You are able to crop all images with the same ratio at once (default) or and any imagesize (and ratio) seperate. = How to use this plugin on ACF taxonomy-images The "Adavanced Custom Fields" plugin has a functionality to add images to taxonomies. To add cropping functionality on these images you have to add a small code-snippet to your functions.php Have a look on the github readme-page for details.

I've cropped the image, but the new version do not appear in the frontend.

If you had viewed your image on the site before, your browser has cached the image. You can hard refresh the page by hitting:

  • "CTRL + F5" (on Windows)
  • "Apple + R" or "command + R" (on Mac/Apple)

Is it possible to crop an non-cropped image-size?

No. The purpose of this plugin is to provide control for the wordpress automatic crop. If you want to crop let's say the full-size image you should

  • a) upload it in a better format in the first place
  • OR b) use the Standard Wordpress-Image editor to crop the image.

Where can I get developer information?

A documentation with a list of all actions and filters can be found on the Github page of the project.

I have two image-sizes that have nearly the same ratio. I want to make use of the feature "Crop all images with same ratio at once", but cause the ratios are slightly different they wont be selected together.

You can add the following filter in the functions.php of your theme to adjust the ratio of one or more specified image-sizes. CAUTION: use only when the ratios are really close. add_filter( 'crop_thumbnails_editor_printratio', 'my_crop_thumbnails_editor_printratio', 10, 2); function my_crop_thumbnails_editor_printratio( $printRatio, $imageSizeName) { if($imageSizeName === 'strange-image-ratio') { $printRatio = '4:3';//do override ratio } return $printRatio; }

I display the cropped image in the backend in an custom meta-box. It does not update after the modal-dialog closed. Is there a way to fix this

Yeah, there is a way. After the crop-thumbnails-modal closed it triggeres a javascript event on the body element. You could use jQuery to cache-break your cropped thumbnail (in backend-view). The event called "cropThumbnailModalClosed". The plugin also provides a global function that could be called (only in post-edit-view and mediathek) to do the cache-break. Example-Code: $('body').on('cropThumbnailModalClosed',function() { CROP_THUMBNAILS_DO_CACHE_BREAK( $('.your-image-selector') ); });

What languages are supported?

You may have a look on the Translation Page.

I want to contribute code.

Fantastic, i published the code on github. But be warned, i am carefully evaluate new features. If you fork and planning to publish the forked plugin, please contact me.

更新日志:

1.9.4 1.9.3 1.9.2 1.9.1 1.9.0 1.8.0 1.7.2 1.7.1 1.7.0 1.6.0 1.5.0 1.4.0 1.3.1 1.3.0 1.2.6 1.2.5 1.2.4 1.2.3 1.2.2 1.2.1 1.2.0 1.1.3 1.1.2 1.1.1 1.1.0 1.0.3 1.0.2 1.0.1 1.0.0 0.10.15 0.10.14 0.10.13 0.10.12 0.10.11 0.10.10 0.10.9 0.10.8 0.10.7 0.10.6 0.10.5 0.10.4 0.10.3 0.10.2 0.10.1 0.10.0 0.9.0 0.8.4 0.8.3 0.8.2 0.8.1 0.8.0 0.7.2 0.7.1 0.7.0 0.6.0 0.5.0