Would be nice to know if this will receive any updates.
]]>Seems there’s an issue with the latest version of ACF (v. 5.8.7) and the crop function. The overlay covers the crop box making it impossible to save the cropped image since the buttons are no longer accessible.
]]>Hello,
I am interested in using this plugin but it seems that it hasn’t been updated in 2 years and the questions don’t seem to be resolved. Is the author still planning to provide updates and compatibility with latest ACF and WordPress updates? If not, does someone suggest a plug-in that provides the same features?
Thanks,
Mark
]]>Hey,
I’m getting the following error when I click the crop button.
PHP Fatal error: Uncaught Error: Call to undefined method WP_Error::set_quality() in /wp-content/plugins/acf-image-crop-add-on/acf-image-crop-v5.php:526
Stack trace:
#0 /wp-content/plugins/acf-image-crop-add-on/acf-image-crop-v5.php(502): acf_field_image_crop->generate_cropped_image('2756', '0', '1920', '221', '656', '1200', '270', true, 'medium')
...
thrown in /Users/tom.benyon/Projects/WP_DEV_ENV/wp-content/plugins/acf-image-crop-add-on/acf-image-crop-v5.php on line 526
It’s referring to this code block and the last line here is throwing the error:
function generate_cropped_image($id, $x1, $x2, $y1, $y2, $targetW, $targetH, $saveToMediaLibrary, $previewSize){//$id, $x1, $x2, $y$, $y2, $targetW, $targetH){
require_once ABSPATH . "/wp-admin/includes/file.php";
require_once ABSPATH . "/wp-admin/includes/image.php";
// Create the variable that will hold the new image data
$imageData = array();
// Fetch media library info
$mediaDir = wp_upload_dir();
// Get original image info
$originalImageData = wp_get_attachment_metadata($id);
// Get image editor from original image path to crop the image
$image = wp_get_image_editor( $mediaDir['basedir'] . '/' . $originalImageData['file'] );
// Set quality
$image->set_quality( apply_filters('acf-image-crop/image-quality', 100) );
This means your error handling that follows this line is not working.
Because of that the front end gets hung in a state where cancel and Crop buttons are deactivated as a 500 error is getting returned from the AJAX response.
The suggested code below fixes two issues. Firstly it ensure your error handling still triggers if the $image is not grabbed correctly. Secondly it fixes an issue for users like me who have their images stored on a CDN. The way you were grabbing the image didn’t cater for this.
function generate_cropped_image($id, $x1, $x2, $y1, $y2, $targetW, $targetH, $saveToMediaLibrary, $previewSize){//$id, $x1, $x2, $y$, $y2, $targetW, $targetH){
require_once ABSPATH . "/wp-admin/includes/file.php";
require_once ABSPATH . "/wp-admin/includes/image.php";
// Create the variable that will hold the new image data
$imageData = array();
// Fetch media library info
$mediaDir = wp_upload_dir();
// Get original image info
$originalImageData = wp_get_attachment_metadata($id);
// Get image editor from original image path to crop the image
$image = wp_get_image_editor( wp_get_attachment_image_src($id)[0] );
if (method_exists($image, 'set_quality')) {
// Set quality
$image->set_quality(apply_filters('acf-image-crop/image-quality', 100));
} else {
$image = new WP_Error( '500', "Could not edit selected image. Does this image exist on the server?");
}
This does not fix everything but this was all the time I could justify investing in this.
The remaining issue is that although your code completes without error now, the image stored is simply a black rectangle.
For context I am using the AWS S3 Offload plugin for my image storage.
Thanks,
Tom
]]>Hi,
I just thought I’d drop a message in here to let people know that this plugin has started working again. A prior version of ACF 5.7.x broke compatibility, but since 5.7.9 (possibly before) it works again!
Sweet ??
]]>There is an overlay which is preventing the ‘crop’ button from being clicked.
find file:
/plugins/acf-image-crop-add-on/css/input.css
and add “display:none;” to #acf-image-crop-overlay at the bottom
hope this helps
]]>I changed an Image field in an existing acf_form() to edit a user profile to be this Crop Image instead. But I can’t select a new image or crop or anything. I get js errors like this:
acf-input.min.js?ver=5.7.7:3 Uncaught TypeError: Cannot read property ‘query’ of undefined
]]>Hi,
I am trying to use this plugin with gutenberg acf blocks, but after I do the crop the image is not updated neither on the block, but it is created and added to the media.
Are you guys planning on porting this to acf blocks?
best regards
]]>Hello
Love your plugin.
I would like to translate it to Danish. Could you make that possible?
]]>Hi
Im trying to keep the server clean from all the original images, sometime rather big in size.
Is it possible to delete original uploaded images after cropping is done.
Thank you.
schalk
]]>Is this plugin definitely still supported & compatible with the latest WP & ACF etc?
We have an issue where if we select an image (plenty large enough) it brings up the modal window, but then upon clicking ‘Crop!’ it reduces it to a tiny size surrounded by black. (See screenshots at https://imgur.com/a/1aFoPgG)
We’re running on the latest…
Is anyone else having this issue or have an idea of how to fix it?
Many thanks, Matt
]]>How can I keep the image meta datas caption and description in cropped images.
After cropping the new image has lost its meta data.
I would like to insert the contents of a textbox the user fills out (but doesnt submit) before they crop the image……………..into the
<div class=”crop-preview”>
(a div with contents of field)
<h4><?php _e(‘Preview’,’acf-image_crop’); ?></h4>
etc.
i was trying “<h2><?php the_field(‘text’); ?></h2>”…but this doesnt work
Thanks and sorry to post again so soon.(im not sure how to delete the post before ..but it is resolved)
]]>I am trying to get the cropped image to be set as “Featured Image” I have a submission form which sets the featured image when the the field type is only “image” But when i set it to “Image with user-crop” it no longer registers as the featured image.
here is my code in functions.php:
// Set Featured Image from ACF Field
function acf_set_featured_image( $value, $post_id, $field ) {
if($value != ”){
update_post_meta($post_id, ‘_thumbnail_id’, $value);
} else {
if ( has_post_thumbnail() ) {
delete_post_thumbnail( $post_id);
}
}
return $value;
}
add_filter(‘acf/update_value/name=tsm_featured_image’, ‘acf_set_featured_image’, 10, 3);
Hi there.
First I have to say that this is a fantastic plugin.
I just wonder if somebody is aware of the fact that deleting a post or page does not delete cropped images.
Also by using the media browser within WP does only delete the source image and its thumbnails – bot not the ones that had been created by the acf crop add on.
Is this a bug?
]]>When trying to edit the added image (cropped) in a post, the modal looks like this:
No errors in console, any ideas?
This issue was also reported here: https://github.com/andersthorborg/ACF-Image-Crop/issues/60
]]>I would love to see field options for enforcing file type and size just like the core ACF image field has. I make heavy use of these to prevent clients from inevitably uploading 10MB images in PNG format, killing the page load times!
]]>AFC Version 5.3.9 – WordPress Version 4.9.5
I just had contact from a customer saying that most of their images were displaying.
When I checked the admin the field type selection were showing as either invalid or had changed to gallery. The Cropped image field is no longer there.
When I change the option back to images, I’m able to select the correct image but it’s displaying it thumbnail twice in the admin with the crop button underneath. The crop button does not appear to do anything. Fortunately the images display as they should on the front end.
]]>I’m using Advanced Custom Fields: Image Crop Add-on on a site (with the latest version of WP and ACF Pro). I’ve successfully used this combination of plugins on may sites, but for some reason this time around I’m getting a 500 error in the console when I execute a “Crop”. Because of this error the image doesn’t crop and the overlay stays active while both the “cancel” and “crop” buttons appear to be deactivated. The strange part is that the functionality is working fine on my local MAMP install, but it appears to not be working on live on an AWS server even though PHP versions match and its a direct clone of my local copy of the site. Thoughts? Any help/direction is appreciated!
Here is the console error:
POST /wp-admin/admin-ajax.php 500 (Internal Server Error)
send @ load-scripts.php?c=1&load[]=jquery-core,jquery-migrate,utils,jquery-ui-core,jquery-ui-widget,jquery-ui-mouse,jquery-ui-sortable,moxiejs,plupload&ver=4.9.4:4
ajax @ load-scripts.php?c=1&load[]=jquery-core,jquery-migrate,utils,jquery-ui-core,jquery-ui-widget,jquery-ui-mouse,jquery-ui-sortable,moxiejs,plupload&ver=4.9.4:4
n.(anonymous function) @ load-scripts.php?c=1&load[]=jquery-core,jquery-migrate,utils,jquery-ui-core,jquery-ui-widget,jquery-ui-mouse,jquery-ui-sortable,moxiejs,plupload&ver=4.9.4:4
performCrop @ input.js?ver=4.9.4:421
(anonymous) @ input.js?ver=4.9.4:289
dispatch @ load-scripts.php?c=1&load[]=jquery-core,jquery-migrate,utils,jquery-ui-core,jquery-ui-widget,jquery-ui-mouse,jquery-ui-sortable,moxiejs,plupload&ver=4.9.4:3
r.handle @ load-scripts.php?c=1&load[]=jquery-core,jquery-migrate,utils,jquery-ui-core,jquery-ui-widget,jquery-ui-mouse,jquery-ui-sortable,moxiejs,plupload&ver=4.9.4:3
]]>No matter what option we choose for “Save cropped image in media library”, the raw info stored by the field in its respective meta is not an image id, so other plugins that may use that info can’t figure out an id…
Example of plugin that breaks: Admin Columns (codepress-admin-columns)
]]>Hi. This plugin has not been updated in awhile. Can the developer respond with an update as to any plans to bring the plugin up to date with the current WP version?
]]>In last version, if you specify preview size (for back-office edition), the plugin still displays the “cropped size”
]]>Question is in the title ??
]]>I’ve installed your plugin, and follow the instruction and update the functions.php.
I do a simple form with upload form in front-end page, but nothing happens, the file is uploaded without crop or others stuff.
Is there something else to do?
I used ACF PRO 5.4.0-beta3 for about 2 years. Since the latest update to the plugin version 1.4.12 the plugin doesn’t work any longer.
On my theme options page the image_crop field is shown twice and on post / page editor it isn’t shown any longer. I tested the configuration with version 1.4.11 today and all was fine.
Maybe you can help me.
]]>Cropped preview image not scaling to fit meta box. Edit delete buttons not absolutely positioned on image.
]]>I have a problem with the ‘Add Image’ button on the front end. It works fine if I’m logged in as admin, but if I’m logged in as a different (non-admin) user role then button just doesn’t work.
I’m wondering if I’m missing a setting with ACF Crop Image plugin or maybe there’s something else I’m missing?
Help appreciated!
Cheers
I have installed this plugin, but when I click on settings from the plugins dashboard, it takes me to media settings, where I am not finding any special settings. Am I missing something?
]]>@andersthorborg great plugin!
I may have found a small JS bug though… as it seems to be firing in Firefox. When trying to “Add Image” for any Image with user-crop field I get the following console error (in Firefox):
TypeError: wp.media is undefined
*This happens when using ACF PRO on the front-end (not /wp-admin/).
Let me know if you see anything obvious.
Cheers,
Ali
How easy would it be to be able to specify just a ratio crop?
I’m using this plugin the the aq_resizer script which I use to create multiple image sizes to fill the srcset of my image. Ideally I’d want the user to upload an image at a minimum size with the correct ratio but have the option of uploading a double size image for hi-res screens.
Currently I can only set a fixed size for the crop, so I have to choose whether to set it to the 1x image dimenions of the 2x image dimensions for hi-res, which removes the ability to make uploading 2x images optional..
..If I could just specify an image ratio in the admin, then this plugin would crop the uploaded image to the correct ratio, then aq_resizer could handle resizing that image down to the required sizes, 1x and 2x.
]]>