2017 © Pedro Peláez
 

wordpress-plugin acf-image-aspect-ratio-crop

ACF field that allows user to crop image to a specific aspect ratio

image

joppuyo/acf-image-aspect-ratio-crop

ACF field that allows user to crop image to a specific aspect ratio

  • Friday, July 13, 2018
  • by joppuyo
  • Repository
  • 1 Watchers
  • 3 Stars
  • 85 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 3 Open issues
  • 5 Versions
  • 44 % Grown

The README.md

ACF Image Aspect Ratio Crop Field

GitHub Workflow Status GitHub Workflow Status WordPress plugin WordPress Plugin Active Installs WordPress Plugin Rating WordPress Plugin Required PHP Version WordPress Plugin: Required WP Version WordPress Plugin: Tested WP Version codecov Active Development, (*1)

A field for Advanced Custom Fields that forces the user to crop their image to specific aspect ratio or pixel size after uploading. Using an aspect ratio is especially useful in responsive image use cases., (*2)

After cropping, a new cropped image variant is created in the gallery and saved into the post. Thumbnails are also generated for the new image. User can re-crop the original image at any time from the post page., (*3)

The cropped image variants are hidden by default in the media browser and on the media page but you can view them by selecting the "list view" on the media page., (*4)

Modes of operation

There are three modes of operation: aspect ratio, pixel size and free crop. You can select this option when creating the field in ACF field options., (*5)

Aspect ratio

Use this option if you want the image to be of specific aspect ratio like 16:9 but the pixel size is not important., (*6)

After selecting an image, user can select an area from the image that matches this aspect ratio. When crop button is pressed, the area is cropped from the original image., (*7)

If you need a smaller image size, you make use of WordPress's thumbnail functionality to access a smaller version of the image., (*8)

Pixel size

Use this option if you need a specific pixel size image like 640x480. User will not be able to select an image smaller than the defined pixel size., (*9)

After selecting an image, user can select an area from the image they want, which can be larger than the pixel size but may not be smaller. The aspect ratio of the selection is locked according to the pixel size., (*10)

When crop button is pressed, the area is cropped from the original image. After the crop is complete, the image will be automatically scaled down to the pixel size. This means the final image will always be the specified size., (*11)

Free crop

Crop can be done freely, there are no aspect ratio limitations., (*12)

Screenshots

Cropping an image to 16:9 aspect ratio

Screenshot of cropping an image, (*13)

Cropping in progress

Screenshot of cropping in progress, (*14)

Option to re-crop the image after upload

Screenshot of the image field, (*15)

Download

You can download the plugin from the WordPress plugin directory, or download the latest release as a zip file from GitHub releases., (*16)

Requirements

  • WordPress 4.9 or later
  • PHP 5.6 or later
  • Advanced Custom Fields 5.8 or later (Pro or Free)

Compatiblity

  • Polylang Pro
  • Enable Media Replace
  • WP Offload Media, Media Cloud and other plugins that move media files to remote location

Frequently Asked Questions

Can I use this plugin with a front-end acf_form?

Yes, this functionality has been added in version 5.0.0. Please test it and give feedback if you encounter any issues., (*17)

Can I access metadata in the original image from a cropped image?

Yes, the original image data is saved under original_image key in the returned ACF array. You can access data such as alt text, description and title this way., (*18)

Can I use this plugin with Elementor?

No, not really. Elementor only supports built-in ACF fields. Please contact Elementor support and ask them to add support for 3rd party fields. For some workarounds for limited Elementor support, see this post., (*19)

Can I use this plugin with Beaver Builder?

No, not really. Beaver Builder only supports built-in ACF fields. Please contact Beaver Builder support and ask them to add support for 3rd party fields. However, there is a work around this limitation by using a plugin called "Toolbox For Beaver Builder". Please see their website for more details., (*20)

How is this different from the other plugin?

This plugin is similar to Advanced Custom Fields: Image Crop Add-on. I originally created a fork of that plugin to add functionality I need: specifying an aspect ratio instead of pixel size. Unfortunately the plugin doesn't seem to be maintained anymore so my pull request was not merged., (*21)

So I created ACF Image Aspect Ratio Crop from scratch as an alternative to ACF Image Crop., (*22)

Possibility to use a pixel size instead of aspect ratio was added later on because I got so many requests for adding that feature., (*23)

The other plugin is not actively maintained and does not work well with latest ACF versions. I try to maintain this plugin as best as I can when new versions of ACF and WordPress come out., (*24)

Thanks

Special thanks to Anders Thorborg for ACF Image Crop which served as a inspiration for this plugin. Also, thanks to Fengyuan Chen for the cropper.js library!, (*25)

License

GPL v2 or later, (*26)

The Versions

13/07 2018

dev-master

9999999-dev

ACF field that allows user to crop image to a specific aspect ratio

  Sources   Download

GPL-3.0-or-later

by Johannes Siipola

12/07 2018

v1.0.3

1.0.3.0

ACF field that allows user to crop image to a specific aspect ratio

  Sources   Download

GPL-3.0-or-later

by Johannes Siipola

10/07 2018

v1.0.2

1.0.2.0

ACF field that allows user to crop image to a specific aspect ratio

  Sources   Download

GPL-3.0-or-later

by Johannes Siipola

10/07 2018

v1.0.1

1.0.1.0

ACF field that allows user to crop image to a specific aspect ratio

  Sources   Download

GPL-3.0-or-later

by Johannes Siipola

21/04 2018

v1.0.0

1.0.0.0

ACF field that allows user to crop image to a specific aspect ratio

  Sources   Download

GPL-3.0-or-later

by Johannes Siipola