deliciousbrains / wp-image-processing-queue

Resize WordPress images in the background
203 stars 18 forks source link

Problem when web site is protected by a htaccess/htpasswd #13

Closed fperro closed 6 years ago

fperro commented 6 years ago

Hi,

I am using WordPress 4.8, Image Processing Queue v0.2 via plugins and Offload S3 Lite to store medias on an Amazon bucket. In the development process of a web site, we often need to make a version available of the web site to our client so he can enter or modify his content in the admin panel. The version we make available to the client is protected with a htaccess/htpasswd to prevent Google to crawl the web site until the official release. This protection make the image processing impossible. Do you have any idea on how we can make it work also in this context?

Thank you.

A5hleyRich commented 6 years ago

I would suggest upgrading to version 1.0.0 (released earlier today), which should alleviate the issue. If not, you will need to exclude /wp-admin/admin-ajax.php from password protection.

fperro commented 6 years ago

I've done the upgrade and also exclude /wp-admin/admin-ajax.php from password protection. Unfortunately both of these solutions are not working.

fperro commented 6 years ago

I've rollback to v.02 and I've try to exclude /wp-admin/admin-ajax.php from password protection and it worked. Thanks for the solution.

On the other hand, I've tested the new 1.0 version locally and it was very very slow to generate the differents images sizes compare to v.02. Is it normal?

A5hleyRich commented 6 years ago

In version 1.0.0 the images are processed via cron with an interval of 3 minutes.

fperro commented 6 years ago

So If I need to generate 6 different images sizes, it will take 6 x 3 minutes?

A5hleyRich commented 6 years ago

@fperro that's a good point. The background job should process all that need generating in a single batch. I'll push a fix for that.

fperro commented 6 years ago

It will be a good improvement! Maybe the interval for the cron could be shorter too?

A5hleyRich commented 6 years ago

Actually, you can specify that when setting up the cron worker:

wp_queue()->cron( 3, 1 ); // Attempt failed resizes 3 times and process the queue every 1 minute

Sorry, still working on the documentation!

fperro commented 6 years ago

If I use Image Processing Queue as a plugin, to specify that, I will need to modify the plugin? Right?

A5hleyRich commented 6 years ago

That's correct. I'll make that filterable https://github.com/deliciousbrains/wp-image-processing-queue/issues/14

So If I need to generate 6 different images sizes, it will take 6 x 3 minutes?

I've been digging into this further and my original response isn't correct. All 6 image sizes should generate in a single cron tick, presuming they don't take long to generate.

fperro commented 6 years ago

Not sure about the fact that all 6 images sizes are generated in a single cron tick. When I tested the v.02, they really take long to generate and seems to generate one size at a time.