AndrejKMI
Forum Replies Created
-
Here it is:
Issue 588Should i do this on the github repo instead?
https://github.com/craftsmancoding/custom-content-type-manager/issues
Forum: Plugins
In reply to: [EWWW Image Optimizer] Custom Upload Path by Post Type (S3) EWWWMakes sense, thanks for the help.
Forum: Plugins
In reply to: [EWWW Image Optimizer] Custom Upload Path by Post Type (S3) EWWWOh, ok.
I’m bypassing local upload altogether.
It does look like it’s optimizing the images, but not pulling the path in that one instance.Forum: Plugins
In reply to: [EWWW Image Optimizer] Custom Upload Path by Post Type (S3) EWWWHere you go:
https://pastebin.com/RPCQvdfeThanks
Forum: Plugins
In reply to: [EWWW Image Optimizer] Custom Upload Path by Post Type (S3) EWWWIt does seem like EWWW knows where the images are since the thumbnail and every other size instance where the image is shown works. It’s just the ‘Image Optimizer’ column that doesn’t show.
.
So I reached out to the EWWW developer and he suggested using ‘wp_generate_attachment_metadata’ instead of ‘wp_update_attachment_metadata’
I’m marking this resolved. Thanks!
Forum: Plugins
In reply to: [EWWW Image Optimizer] Custom Upload Path by Post Type (S3) EWWWHi, That worked!
Everything works well now except that in the Library list view under the column ‘Image Optimizer’ I see “Could not retrieve file path.” for any image/file I upload to S3. The image path is correct and works in every other instance (viewing/editing the image/thumbs). Is EWWW unable to optimize images when they are uploaded to S3?Thanks for the help.
Thanks for all of the help.
So, changing the priority to below 15 doesn’t work, but commenting out the lines you initially suggested does work. The issue is that commenting out those lines seems to break EWWW in terms of retrieving the image from S3 and it’s changing core plugin code.Really appreciate your help.
When EWWW is enabled this is the $data that is returned.
PHP Console show:
Object {ewww_image_optimizer: “Unknown type: application/zip”, file: “2015/03/filename.zip”}Ok, I debugged it and found that it works if EWWW Image Optimizer is disabled.
Is this a conflict in priority between EWWW and add_filter in this function?How can I make the two work together?
Thanks
I’m putting it at the very bottom of the functions.php file.
Yeah, I have Path on and Year/Month turned off.
Thanks for the reply, no problem on the delay, your help is greatly appreciated.
I’m still not getting custom paths. Everything uploads to wp-content/uploads/ still.
This is my code now:function wp_update_attachment_metadata_s3( $data, $post_id ) { $parent_id = get_post_field( 'post_parent', $post_id ); $type = get_post_type( $parent_id ); $path = ''; switch ($type) { case 'project': $path = 'project'; break; default: $path = 'default'; break; } if ( $path ) { add_filter( 'as3cf_setting_object-prefix','dynamic_path_'.$path, 10,1 ); } return $data; } function dynamic_path_project( $value ) { return 'project'; } function dynamic_path_default( $value ) { $t = date('m Y'); $time = explode(" ", $t); $month = $time[0]; $year = $time[1]; return 'uploads/' . $year . '/' . $month; } add_filter( 'wp_update_attachment_metadata','wp_update_attachment_metadata_s3', 20, 2 );