Open alimuzzaman opened 5 years ago
The corresponding commit is in https://github.com/litespeedtech/lscache_wp/commit/3ff72fd135f36b521e806592181b3ea291922c2b and https://github.com/litespeedtech/lscache_wp/commit/14fb30a21527af68b8473273819b64b0d920c3e5
You can install the latest commit version to test it.
Case 1:
please use filter litespeed_media_info
to manipulate url&md5&size.
Yes you can replace the url
with external GCS links. As long as the file md5 is accurate.
Case 2: As mentioned above, no need to download before sending request.
To operate files, please use action hooks litespeed_media_del
and litespeed_media_rename
.
Thanks.
Thanks Hai,
Will test and let you know soon.
Best Regards, Alim
Alimuzzaman Alim, Developer Usability Dynamics, Inc. https://UsabilityDynamics.com
From: Hai Sent: Tuesday, May 21, 2019 11:34 PM To: litespeedtech/lscache_wp Cc: Md. Alimuzzaman Alim; Author Subject: Re: [litespeedtech/lscache_wp] WP Stateless compatibility (#143)
The corresponding commit is in 3ff72fd and 14fb30a You can install the latest commit version to test it. Problem 1: Case 1: please use filter litespeed_media_info to manipulate url&md5&size. Yes you can replace the url with external GCS links. As long as the file md5 is accurate. Case 2: As mentioned above, no need to download before sending request. Problem 2: To operate files, please use action hooks litespeed_media_del and litespeed_media_rename. Thanks. — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.
This email has been checked for viruses by Avast antivirus software. https://www.avast.com/antivirus
Hello @hailite,
[x] rename()
on line img_optm.class.php#L1080 is throwing a warning. Please check if the file exists first.
[x] Please move $target_size = filesize( $local_file ) ; before litespeed_img_pull_ori
action. Because we are deleting the local file on this hook, it is throwing warning.
[x] Also move $webp_size = filesize( $local_file . '.webp' ) ; before litespeed_img_pull_webp
action.
OK will do tomorrow and update here soon.
Fixed in https://github.com/litespeedtech/lscache_wp/commit/9f830114e07f8c5cd1dc70b8189c909e007afc27 and will be included in v2987 soon.
Our plugin have Settings called Stateless, if it is on our plugin delete file from server and only keep them in Google Cloud Storage (GCS).
We are currently utilizing this filters _litespeed_img_pullori, _litespeed_img_pullwebp, _litespeed_media_checkori, _litespeed_media_checkwebp.
Example GCS url: https://storage.googleapis.com/udx-ci-develop-alim/rabbit.ci/2019/05/f85a978b-blue-abstract-moving-flowing-150x150.png
Problem 1: Sending for optimization
Case 1:
So we were thinking if you can add a filter to bypass the file exists check in
LiteSpeed_Cache_Img_Optm::_img_queue()
function. https://github.com/litespeedtech/lscache_wp/blob/master/litespeed-cache/inc/img_optm.class.php#L597And another filter to modify
$img_info
variable, so that we can update$img_info['url']
to GCS url.If your server can pull image from GCS server then we don't have to pull the image to users server before starting optimization. As it's totally unnecessary will have performance.
Case 2:
If you can't pull image from provided GCS url then we suggest that you add a action before sending the processing request.
Most likely position would be at the beginning of
LiteSpeed_Cache_Img_Optm::_request_optm()
, so we can make download the images to server from GCS beforeLiteSpeed_Cache_Img_Optm::_img_queue()
checks if file exist.Problem 2: Restore Backup image
We would require two action hook one before starting restore and one after restore complete. So that we can make the backup image available to server if not exists then. After restore complete upload the original images to GCS.
Please pass attachment ID with all hooks.
LiteSpeed Cache Image Optimization compatibility wpCloud/wp-stateless#365