joppuyo
Forum Replies Created
-
Hey,
This plugin uses the built-in WordPress image editor to crop the image. You can use the WordPress jpeg_quality hook to change the quality of the cropped image. By default the quality is 82.
It’s normal behavior that in some cases the cropped image is bigger than the original. For example, if you save the image with quality 50 and then the image is cropped and re-encoded with quality 82, the resulting crop is larger than the original.
Hey,
This field works inside a repeater in my testing. But it’s possible that there’s an edge case bug or there’s a conflict with a third-party plugin. It’s really hard to try to debug this issue without additional information.
Can you post the following things:
– WP version
– ACF version
– Where the field is located (page, post, term etc.)
– Any errors in the browser console when encountering this issueThanks!
Currently, this feature isn’t planned. However, you can use the crop field inside a repeater field to approximate this functionality.
Forum: Plugins
In reply to: [Disable Media Pages] Index.php bug… breaks WP-RocketOk great. I will close this topic but feel free to open another one if you encounter any further issues.
Forum: Plugins
In reply to: [Disable Media Pages] Index.php bug… breaks WP-RocketI just released version v2.0.1 on www.ads-software.com that contains this fix. Could you verify everything works as it should one more time and I can then close this ticket? And big thanks for bringing this issue to my attention, I would not have realized this bug otherwise.
Forum: Plugins
In reply to: [Disable Media Pages] Index.php bug… breaks WP-RocketHey, no need to do that.
I realized that there’s a problem with how the plugin hooks to the template_redirect filter that causes different behavior compared to normal WordPress.
Could you try to install a pre-release version of the plugin (2.0.0) which is available here: https://github.com/joppuyo/disable-media-pages/releases/tag/v2.0.0 ?
If it fixes the issue, I will release a new version on www.ads-software.com. It’s gonna be a major 2.0.0 version because it technically changes how to plugin works.
Forum: Plugins
In reply to: [Disable Media Pages] Index.php bug… breaks WP-RocketHey,
I am not aware of this issue. It is possible that this is a conflict between several plugins. Could you try to reproduce this issue without any plugins installed?
Could you then write down the exact steps to reproduce this issue with a brand new WordPress installation?
Thanks!
Hey, unfortunately, there is currently no way of preventing this but I am planning to add this feature in a future version of the plugin. You can follow this ticket on GitHub for more updates.
Forum: Plugins
In reply to: [Advanced Custom Fields: Image Aspect Ratio Crop Field] Set as featured imageHey, here’s the code I’ve been using on my own projects.
add_action('acf/save_post', function ($post_id) { $value = get_field('my_acf_field_name_here', $post_id); if ($value) { if (!is_numeric($value)) { $value = $value['ID']; } update_post_meta($post_id, '_thumbnail_id', $value); } elseif($value === false) { delete_post_meta($post_id, '_thumbnail_id'); } }, 11);
Just change the field name to the one you are using on your site. Keep in mind that this only works if the return type is set to array or id.
Unfortunately I am not planning to include this functionality in the plugin. If you are interested in my reasoning, see this GitHub issue: https://github.com/joppuyo/acf-image-aspect-ratio-crop/issues/105
You said that you want to upload the original image to a folder named “original-images-submitted” ? Could you check that the images are stored in that folder? You can use something like a FTP client to do this.
Can you check where the file is stored on the server? Regardless of the folder where the image files are stored, the image will show up in the media library.
Yes, you can put the code in the theme functions.php file.¨
Your code looks good to me.
If there are any issues with the code, it is enough to delete the code in this case.
Hey, here’s the code I managed to put together.
I worked in my testing but I would recommend you to test the code in a local or a staging environment before deploying it to production.
Please note that the code will only work for images uploaded through the front-end forms. Images uploaded in the WordPress admin use a different way of uploading.
add_filter('upload_dir', function ($uploads){ global $wp; if (defined('REST_REQUEST') && REST_REQUEST && !empty($wp->request) && stripos($wp->request, 'wp-json/aiarc/v1/upload') !== false) { $custom_dir_name = 'my-custom-dir-here'; if (!empty($uploads['subdir'])) { $new_subdir = '/' . $custom_dir_name . $uploads['subdir']; $uploads['subdir'] = $new_subdir; $uploads['path'] = $uploads['basedir'] . $new_subdir; $uploads['url'] = $uploads['baseurl'] . $new_subdir; } else { $uploads['subdir'] = '/' . $custom_dir_name; $uploads['path'] = $uploads['path'] . $uploads['subdir']; $uploads['url'] = $uploads['url'] . $uploads['subdir']; } } return $uploads; }, 10, 1);
This code should go in your theme or a custom plugin.
- This reply was modified 2 years, 11 months ago by joppuyo.
Actually, disregard my previous message, I didn’t realize you would also need to backup the images. I will see if I can figure out a way to attach a filter to the file upload process so the upload folder can be modified.