Giter Club home page Giter Club logo

acf-image-crop's People

Contributors

andersthorborg avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

acf-image-crop's Issues

Add image quality option

In the current version of the plugin a quality value of 100 is used when the crop is applied.
$image->set_quality( apply_filters('acf-image-crop/image-quality', 100) );

This unnecessarily blows up the filesize of the generated images and should by default better be set to 90%.

I'd even more appreciate a hook into the plugin to set the compression quality from my functions.php or have an option in the WP-admin's plugin settings.

[Feature Request] Pass post_id with perform_crop ajax function

Latest version of acf-image-crop (1.4.9) introduce a new filter to customize the postfix of a cropped image.
At this point could be very useful, during the execution of this filter, to know the post_id of the current post where the cropped image is attached.
This way we can strongly customize the name of a cropped image, even based of the current parent post.
This could be easily done passing the post_id variable within the perform_crop function.

Image Object Selectable with Save cropped image in media library set to No

So, I'm probably missing something, but the documentation says the only way to use the tool if you've set "Save cropped image in media library" to "No" is via the "Image URL", but "Image Object" is still accessible.

This is fine (in fact, it might be preferred for me), but it appears to still save a cropped image in the media library.

It looks like the only way to reference both the crop and non-cropped versions of an image (which is what I want to do) are if done via the Image Object or possibly via Image ID, or is there a way to do that via Image URL as well?

Ideally I'd like to be able to have only one image saved, and reference the cropped data, as well as the original image. Does that make sense?

Is that possible, and I'm just doing something wrong?

fix for missing metadata in cropped image

in the cropped image the description, caption and alt metadata ist lost.

find

 // Get the filetype
                $wp_filetype = wp_check_filetype(basename($targetFilePath), null );
                $attachment = array(

before this get the date as vars:

$originalFileObject = get_post($id);
$originalFileDescription = $originalFileObject->post_content;
$originalFileCaption = $originalFileObject->post_excerpt;
$originalFileAlt = $originalFileObject->_wp_attachment_image_alt;

the change the array:

$attachment = array(
                     'guid' => $mediaDir['url'] . '/' . basename($targetFilePath),
                     'post_mime_type' => $wp_filetype['type'],
                     'post_title' => preg_replace('/\.[^.]+$/', '', basename($targetFilePath)),
                     'post_content' => $originalFileDescription, // new!
                     'post_excerpt' => $originalFileCaption,	// new!
                     'post_status' => 'inherit'
                );

and after this add the alt to the new file:
update_post_meta( $attachmentId, '_wp_attachment_image_alt', $originalFileAlt );

"Uncaught TypeError: undefined is not a function" when editing Widgets

  • Advanced Custom Fields Pro Version 5.1.7
  • WordPress 4.1
  • Advanced Custom Fields: Image Crop Add-on Version 1.4.1

When I visit Appearance -> Widgets (wp-admin/widgets.php) I'm receiving the following error in my console:

Uncaught TypeError: undefined is not a functioninput.min.js?ver=5.1.7:1
acf.get_selectorinput.min.js?ver=5.1.7:1 acf.get_fieldsinput.js?ver=4.1:435 (anonymous function)input.min.js?ver=5.1.7:1 rinput.min.js?ver=5.1.7:1 tinput.min.js?ver=5.1.7:1 acf.do_actioninput.min.js?ver=5.1.7:1 (anonymous function)load-scripts.php?c=1&load[]=jquery-core,jquery-migrate,utils,underscore,shortcode,plupload,json2,jq…:2 jload-scripts.php?c=1&load[]=jquery-core,jquery-migrate,utils,underscore,shortcode,plupload,json2,jq…:2 k.fireWithload-scripts.php?c=1&load[]=jquery-core,jquery-migrate,utils,underscore,shortcode,plupload,json2,jq…:2 m.extend.readyload-scripts.php?c=1&load[]=jquery-core,jquery-migrate,utils,underscore,shortcode,plupload,json2,jq…:2 J

screen shot 2015-01-22 at 4 58 15 pm

This error only shows up when the Image Crop Add-on is activated (only ACF and Add-On activated - all other plugins deactivated).

Update action broke the whole site

Today I update this plugin and it broke my whole site. Other things were fine but all the images are gone.

I checked the Media page and there are all the images.

I rolled back to version 1.4.11 and it worked again.

I am running WordPress version 4.8.

Cropping very slow

Running latest version of both plugins ACF PRO 5.5.11 / ACF Image Crop Add-on 1.4.10

Crop still works but is very slow. Upwards of 10 seconds.

Returning black image

Hello, your plugin is very useful, thank you!
But I have a problem when I crop the image, it is returned all black.

*Sorry for the bad english x)

captura de tela 2014-02-28 as 11 51 58 1

Add min/max size

It would be great if you could add a feature where you could require the image to be a min/max size.

Needs polishing in WP 4.8.1 + check compatibility with ACF Pro gallery field

Hey guys,

Noticed some CSS quirks in combination with the latest ACF PRO + WordPress version. See screenshot:

acf-crop-image-field-side

Also, please check on the compatibility with the Gallery field. Adding images to a gallery also triggers the "add" function of a crop field on the same page, inserting the cropped version into the gallery as well.

Keep up the good work.

// T

No crop markers visible (ACF 5.4.6 / WP 4.6.1)

This plugin is perfect for my current site, and I was very elated to come across it! Sadly, after install and setting up the field in ACF, the crop modal seems not to function as intended.

The image is shown at full opacity, and when clicking anywhere on the image, it dims as if to show a selection, but no crosshairs or markers show. I've tried it a few times, in a few ways, and inspecting the page / console doesn't help.

Wordpress: 4.6.1
Advanced Custom Fields PRO: 5.4.6
Image Crop Add-on: 1.4.9

Fatal error

If I set Return Value to anything except “Image ID” I get this error:

Fatal error: Cannot use object of type stdClass as array in [snip]/wp-content/plugins/acf-image-crop-add-on/image_crop-v4.php on line 361

This is on a new install, latest version of WordPress, ACF, and your plugin, no other plugins installed, using Twenty Fourteen theme.

[Feature Request] do_action after resize images

Hi, it would be possible to add "do_action" before and after resize images (I mean generation of thumbnail, medium,medium_large,large, etc.., not source file!) from source file? It would be usefull to add some watermark to source image for example.

Doesn't work correctly with ACF Pro 5.2.7

I'm using your plugin in a frontend form and it's been working great. Unforunately it doesn't with the latest version of ACF Pro.

The issues I'm facing:

  1. the cropped version as well as the original size shows in the field inside the form
  2. the crop button is doubled
  3. when I hit one of the crop buttons an empty overlay shows up

Edit and Remove buttons

The edit and remove buttons are no longer working with Version 5.3.2.1 of ACF Pro.

Just need data-name="edit-button" and data-name="remove-button" "button" removed and it works again.

Library: Uploaded to Post vs. All

Built-in Image field includes an option 'Library' allowing selectable images to come from the Media Library or only from images uploaded to the specific post.

Certainly with front-end forms, but also with non-admin post authors, it would be nice to have similar functionality for the image-with-crop field.

Full size crop

Hi there,

If i upload a 1920x1080 image and my crop for example is 735x400 i notice that the cut is always on the top left corner. Is it possible to make this always max centered? In 90% of the user cases people will want to get a wide as possible view.

great work so far 👍 hope you hear from you :)
Paul

ACF Pro 5.7-RC1 - Cannot choose image

I am testing the ACF Pro 5.7 release candidate. I find that I can add an "Image with user-crop" field and that it will display in the page edit screen, but when I click the "Add Image" button nothing happens.

I suspect this is related to the major JavaScript changes between ACF Pro versions 5.6 and 5.7.

Broken with ACF 5.6.1 Update

After updating to ACF 5.6.1 all of my custom fields with cropped images were removed from my site because "Image with Crop" was no longer available as an option in ACF. It defaulted field type to Text instead of Image with Crop.

Image attachment details not working

When trying to edit an image with user crop selected in the acf field options, the Image attachment details section fields are set as readonly. We tried to fix this with a js hack but it doesn't work as details are not saved. Any ideas?

Two Illegal String Offsets in acf-image-crop-v4.php

This plugin is fantastic, but I've noticed one thing: I get PHP warnings in the error log about illegal string offsets for 'retina_mode' and 'hide_cropped' in acf-image-crop-v4.php. Not a huge deal, to be sure, but I think changing lines 922 and 934 to do an isset() for the appropriate key in $options before setting $value fixes this.

Now, I'm not sure why my install is using v4.php instead of v5, but that's a bit beyond my current understanding. That being said, this whole issue may be moot. But I figured I'd let you know anyway.

Keep up the awesome work!

John

Version 1.1.1 bugs and a small feature change request

Hi @andersthorborg

Thank you for quickly fixing the ACF5 issue for us. Much appreciated.

A few issue that we've spotted...

Force user to crop
Can't really see this doing anything. I can still add an image, and publish the page with out cropping the image. What is meant to happen here? Are we missing something?

Save cropped image to media library = yes & Return = Image object
This actually does not seem to create a new media library item anymore? And this is what is returned as the image object...

stdClass Object
(
    [image] => 2014/07/GSX-RL4_action_1_646x340_acf_cropped.jpg
    [preview] => 2014/07/preview_GSX-RL4_action_1_646x340_acf_cropped.jpg
)

So I'm guessing its a little buggy, but it works still. How ever we need it to work differently.


This is how I think it should work. Please trust me here, it's only a small change...

Use this function: Save cropped image to media library

And rename it to: Save cropped image as new media library item

If is 'NO' get the image path of the target image, use this image path and delete using unlink(image) before the new image is cropped, and then save the new cropped version with exactly the same name. Do not add _acf_cropped into the filename. Basically just replace only the target size image with the new cropped version.

This means, we can use the Image URL, Image ID and Image Object. No need to disable Image ID and Image Object this way :-)

!!! Please note you are using an underscore before the dimensions in your image filename, wordpress uses a hyphen just before the image dimensions rather than a underscore. Line 498.

And this is better because you are updating the original media library item. But you are only ever updating the target size. Which is great because this allows the user to have different cropped sizes for all their images sizes, all in the original media item. In turn allowing us to use the Image Object and Image ID.

If is 'YES' then this should just create a new media library item just for this target image size. Just like it did in version 4. And you can add _acf_cropped into the file name for this version so it does interfere with original media item.


We tried to implement this ourselves. But we didn't test the plugin thoroughly enough before we started modifying the plugin, then released the plugin does not create a new media item anymore, so we were struggling to get the whole thing bug free.

Many Thanks

Different crop and position from different fields

I have a site selling plans. Every plan has 2 featured photos, each of which appear on the site in multiple places at different sizes. I could predefine image crop and position sizes in my custom theme's images.php file, but each image would need a different position which can be very tedious to do by number especially multiple times per image.

Is there a way to create a grouped set of custom fields for each plan, and include conditional visibility for the plan crop sizes. Once the user uploads or selects a featured photo for the plan, the custom crop fields appear to crop and reposition the image for different places.

These should be able to be adjusted/reset later, since they should readily rely on the parent photo.

Issue reference: https://wordpress.org/support/topic/different-crop-and-position-from-different-fields

Broken in ACF 5.5.5

After updating to 5.5.5, I am no longer able to save image fields with this plug-in.

I have the field loaded on an options page.

I select, and image, crop it, and save the page.

The page reloads without the image, and it is not saved to the database.

Same if I do not crop it.

Using the standard image field works fine.

Broken with ACF version 5.6.0

Hi there,

With the new update of ACF the plugin doesn't work anymore!

Below are the errors:

Warning: json_decode() expects parameter 1 to be string, array given in /srv/www/perfettivanmelle/htdocs/wp-content/plugins/acf-image-crop-add-on/acf-image-crop-v5.php on line 946

Notice: Undefined index: save_format in /srv/www/perfettivanmelle/htdocs/wp-content/plugins/acf-image-crop-add-on/acf-image-crop-v5.php on line 959

Notice: Undefined index: save_format in /srv/www/perfettivanmelle/htdocs/wp-content/plugins/acf-image-crop-add-on/acf-image-crop-v5.php on line 973

Can you fix this?

Overlay modal not appearing correctly after WordPress 4.2.2 upgrade.

It seems since upgrading to the latest WordPress (4.22) and latest version of ACF the cropper appears inline rather that in an overlay modal. The dark overlay sits over the top of everything, so the tool becomes useless and inaccessible.

I think this requires an urgent fix?

screen shot 2015-07-14 at 12 27 18 am

Plugin breaks media library

Hi Anders,

I get the two following warnings on one of my websites:

PHP Warning:  Illegal string offset 'hide_cropped' in /data/home/.../wp-content/plugins/acf-image-crop-add-on/acf-image-crop-v5.php on line 640
PHP Notice:  Uninitialized string offset: 0 in /data/home/.../wp-content/plugins/acf-image-crop-add-on/acf-image-crop-v5.php on line 640

I fixed the problem by adding the following code:

$hide = ( isset($options['hide_cropped']) && $options['hide_cropped'] );

The PHP version on the server with the problem is: 5.5.17

Large pic field images have been scaled down automatically to 678x300px

There's a problem with the large image fields (in our case, 1800x600px) after the newest WP update.

Screen 1. The image uploaded has/had the right size of 1800x600px. It looks pixelated on the front-end now.
Screen 2. Upon opening one can see the image was somehow resized to the small image field size (678x300px)
3. If try to change the image to a big one from WP Gallery - downsized again.

Please fix, thanks

1 zoomin previev of the uploaded image
2 upon openiung the image

Plugin conflict

When I met this amazing plugin I decided to add it immediately to my boilerplate. However when using this plugin I realized that after cropping ACF-Image-Crop renames files that have already been renamed.

Did I do something wrong? Can you fix it?

Thanks!

Still Maintained?

Is this plugin no longer maintained?

If not, are any other good alternatives anyone can suggest?

Thanks!
Scott

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.