Jump to content

Auto Smush


matjazp
 Share

Recommended Posts

On 19/01/2017 at 0:42 PM, matjazp said:

Sorry for troubles. Please upgrade to 1.0.6 if that fixes it (just uploaded to github).

That worked. Thanks matjazp

I have a site with about 1951 images to be uploaded and downloaded to reShmush.it server

I realise this can be CPU intensive but am running some tests.

I always have an error at around 2% of upload

Quote

Optimizing image 48 out of 1951 - 2% complete An error occured, please try again

 

Each image is well below 5MB. I wondered if there was a limit to the amount of actual images which can be processed at any one time?

 

Link to comment
Share on other sites

Hi, Peter, sorry for late response, it was a busy weekend. Hm, that's unexpected error, it should only pop up if ajax call fail, but since 48 of images got processed ... Could you check /site/assets/logs/autosmush.txt and /site/assets/autosmush/progress.json if there is any clue? Check php error log. Also check the value of max_execution_time in php.ini and apache Timeout directive, maybe the script is timing out (I set it to 1 hour). Also please edit file /site/modules/AutoSmush/AutoSmush.js and change pollTime var from 100 to 500. I just tried with 70 images without problem. Bulk mode in the current state is not very good at processing large amount of images - 1951 is not large at all, but I never tested more than 100 images. Bulk mode needs complete rewrite, but since it worked good enough for small sites I just left it as is...

 

Link to comment
Share on other sites

Not a problem. Thanks for getting back to me.

 

I don't see anything obvious but not entirely sure what to look for.

progress.json only has 1 line:

{"percentComplete":"1","counter":"Optimizing image 32 out of 2039 - 1% complete","percentNew":"0","error":null,"file":"phoot-security.0x100.jpg","basedir":"1079","url":"https:\/\/www.domain.co.uk\/site\/assets\/files\/1079\/phoot-security.0x100.jpg"}

Error log displays a list of files and their reduction and then there's one in error in particular

2017-03-22 12:15:00	Error optimizing /var/www/vhosts/domain.co.uk/httpdocs/site/assets/files/1072/085---dc3420.0x100.jpg, 404

BTW I'm using the online service for all of these. Perhaps I should try install a local optimization tool too?

 

Link to comment
Share on other sites

That 404 is response from resmush.it web service, it happens sometimes. But the optimisation process should continue, regardless of the error - at least that's how its intended to be... As recommended, I would try setting pollTime from 100 to 500 in AutoSmush.js Installing local optimizers would save you sending/fetching the file to/from web service.

Link to comment
Share on other sites

8 hours ago, Peter Knight said:

Forgive my ignorance but when you say 'local optimizers' are these installed on my VPS or on a local machine?

I can't know that. Check the "Advanced options for local tools", the module shoud show you if (and what) optimizers are available on your machine.

Link to comment
Share on other sites

14 hours ago, matjazp said:

I can't know that. Check the "Advanced options for local tools", the module shoud show you if (and what) optimizers are available on your machine.

Sorry - I've managed to confuse you.

I wondered if 'local' meant the optimizers *should* be installed on a server or a local machine.

I'm pretty sure they're server based but I normally understand 'local' to mean the desktop / laptop on front of me.

Anyway, I'm sure optimizers are installed on the host server. No need to revert and thanks again for the help. 

Link to comment
Share on other sites

2 hours ago, Peter Knight said:

I wondered if 'local' meant the optimizers *should* be installed on a server or a local machine.

Oh, I never thought of that! Yes, local means on a computer (server), where PW is installed. Hmm, now I see how confusing can it be. What wording do you propose? 

Link to comment
Share on other sites

  • 4 months later...
On 23/03/2017 at 9:15 PM, matjazp said:

Oh, I never thought of that! Yes, local means on a computer (server), where PW is installed. Hmm, now I see how confusing can it be. What wording do you propose? 

Maybe one of the following?

  • Use local optimization tools (on website server)
  • Use your web servers optimization tools
  • Use optimization on website server

 

Link to comment
Share on other sites

  • 2 months later...
6 hours ago, PWaddict said:

.InputfieldForm label.InputfieldHeader { padding-top: .4em; }

You can comment out the rule and off you go. It has nothing to do with localhost or server, you're probably running different version of AS. I removed padding in v1.1.0.

Link to comment
Share on other sites

27 minutes ago, matjazp said:

You can comment out the rule and off you go. It has nothing to do with localhost or server, you're probably running different version of AS. I removed padding in v1.1.0.

No I'm using the 1.1.0 version on both. You haven't actually removed the padding. You have it like this:

/*
.InputfieldForm label.InputfieldHeader {
    padding-top: .4em;
}

.AdminThemeUikit .InputfieldForm label.InputfieldHeader {
    padding-top: 20px;
}
*/

I don't understand why on localhost it reads that. Is that ok if you remove it completely?

EDIT: It was a cache issue. Localhost was reading the previous version's css. I opened the AutoSmush.css link to refreshed it and problem fixed.

Link to comment
Share on other sites

  • 3 weeks later...

@matjazp - I am thinking about starting to use this, but was wondering your thoughts about maybe integrating https://github.com/spatie/image-optimizer instead or as well as https://github.com/psliwa/image-optimizer

It uses a similar collection of tools for optimizing, but the main difference is that it also includes SVGO which of course adds support for "compressing" SVGs.

I honestly haven't looked into the two libraries much more than that though, so there might be very valid reasons to stay with the one you have.

  • Like 1
Link to comment
Share on other sites

39 minutes ago, matjazp said:

Hm, I can't even upload SVG image, the spinner is running, no js error... Strange, another image field and upload is working. But there are no crop/variations buttons, this is how it should be?

I am not sure why you had issues uploading an SVG in one field. As for why there is no crop/variations - these really aren't that relevant to the a vector file. You could kind of crop by using a clipping mask, but an actual crop is a pretty complex thing that would require a powerful vector editor to achieve because it involves completely changing the paths that make up the Illustration.

Link to comment
Share on other sites

I won't invest time in svg upload issue. Thanks for the info on crop/variations. Missing those two buttons made me fix a bug in AS. Have some issues testing svgo on windows since there is no svgo for windows, the best alternative is svgop executable, but it's almost 40MB.

Link to comment
Share on other sites

4 hours ago, matjazp said:

I won't invest time in svg upload issue. Thanks for the info on crop/variations. Missing those two buttons made me fix a bug in AS. Have some issues testing svgo on windows since there is no svgo for windows, the best alternative is svgop executable, but it's almost 40MB.

Don't worry too much about this - I just thought if it was easy, it would be a nice addition to have SVG support.

Link to comment
Share on other sites

Please grab the latest version (1.1.1) and test. reSmush.it has no support for svg, so you must use web server tools, aka sudo npm install -g svgo. I tested here on windows and included svgo.exe binary that add 8 MB to the download size.

  • Like 1
Link to comment
Share on other sites

  • 2 weeks later...

Sorry for taking so long to get back to you @matjazp - I just tested your svgo implementation and it's awesome!

The only catch I have is with svgo itself. Sometimes it can break svgs - elements can get moved, etc. I am wondering if you have any thoughts about building in an "Accept Compressed Version" ? Maybe another alternative would be a "Restore Original Version" button that would removed the optimized version and replace it with the backed up one?

The other thing I noticed is that if you are running my CustomUploadNames module the backed version keeps the original filename - would you mind changing it to use the new name instead please?

Link to comment
Share on other sites

23 minutes ago, matjazp said:

Will think about undo option, but likely won't be soon, December is a busy month. I never used CustomUploadnames so have to test. I guess we are both hooking to the same method?

Thanks for considering the undo/review option. As for CustomUploadNames, I have adjusted the hook priority in that so you don't need to consider it now in AutoSmush.

  • Like 1
Link to comment
Share on other sites

  • 2 months later...

Great module. Thanks @matjaz!

Looks like https://resmush.it/ is down. Anyone know if the service is still running?

I'm thinking it would be good to swap out resmush.it for ShortPixel or TinyPNG as the external service. I'll fork and submit a pull request if I end up tackling that. Anyone else working on image optimization modules like this?

 

  • Like 1
Link to comment
Share on other sites

  • 11 months later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...