Hey @ds888
You can use _imagify_optimize_attachment function for this. Our repository is public and this function can be found here.
There is no built-in automatic way of doing this, unfortunately :/
Best Regards
Marko
Hi Marko,
thank you for the support and feedback!
We put the following in our functions.php
/**
* Auto-optimize when a new attachment is generated.
*
* @since 1.0
* @since 1.5 Async job.
* @since 1.8.4 Deprecated
* @see Imagify_Admin_Ajax_Post_Deprecated::imagify_async_optimize_upload_new_media_callback()
* @deprecated
*
* @param array $metadata An array of attachment meta data.
* @param int $attachment_id Current attachment ID.
* @return array
*/
function _imagify_optimize_attachment( $metadata, $attachment_id ) {
_deprecated_function( __FUNCTION__ . '()', '1.8.4', 'Imagify_Auto_Optimization::get_instance()->store_upload_ids()' );
if ( ! Imagify_Requirements::is_api_key_valid() || ! get_imagify_option( 'auto_optimize' ) ) {
return $metadata;
}
But after that we have the following error on page load
2021/04/26 19:48:57 [error] 8178#8178: *87353 FastCGI sent in stderr: "PHP message: PHP Fatal error: Cannot redeclare _imagify_optimize_attachment() (previously declared in /var/www/clients/clientx/webxy/web/wp-content/plugins/imagify/inc/deprecated/deprecated.php:255) in /var/www/clients/clientx/webxy/web/wp-content/themes/Child-Theme/functions.php on line 16" while reading response header from upstream, client: , server: toyota-gabelstapler.info, request: "GET /wp-admin/index.php HTTP/2.0", upstream: "fastcgi://unix:/var/lib/php7-fpm/web84.sock:", host: "www.toyota-gabelstapler.info", referrer: "https://www.toyota-gabelstapler.info/wp-admin/upload.php"
Thanks & Regards
Dieter
Hey @ds888
Sorry, it can not be done that way. You would have to hook into it during the import process and it would require more coding.
It would be ideal to hire a developer for this as they could check the existing cronjob and modify it.
Best Regards