[API] Smush it

cajkan

Active Member
Hello VL,

Since google cares about pagespeed, tell us how to improve our site, they recommend us to compress our images.
Now maybe this is great idea, if we can use Smush it for our users banners.
Once user uploads banner, automatically to be compressed.

Benefits:
Our website will load faster
Visitors will browse our website faster ( even on mobile/tablets )
Search engine friendly site (fast load time)
 

Mark

Administrator
Staff member
Smushit is great, I use it all the time but their API is not reliable.

Infact the entire smushit service fails quite often, which is a real shame.
 

Basti

Administrator
Staff member
Correct me if iam wrong, but gzip / mod_deflate ( htaccess ), also compresses images. Isnt that normally enough?
Or does such services remove quite a bit a bytes from a max. 100kb banner?
 

cajkan

Active Member
Well this kind of service can compress from 10-40%, example if banner is 100 kb s, can be lowered to 40kbs with same quality.

I was surprised but its working, i recommend for banners, logos and backgrounds.
 

Basti

Administrator
Staff member
hmm but gzip, mod_deflate usually compress up to 70%, at least whenever i used it. Guess it could work well together if combined to further reduce size.
Dont know if that might be overkill though, but all for naught if it not reliable.
 

Mark

Administrator
Staff member
smushit offers lossless compression, it saves space in images gzip cannot.

If it were stable, it would have been integrated into many projects years ago. I suppose we could code it with a failsafe for those instances where smushit doesn't work, some optimized images would be better than none.
 

top50servers

Active Member
Could you run it on some sort of timer?

  • Check if the API works every hour.
  • If no, wait for another hour and repeat.
  • If yes, compress the images and rename to {banner}_smush (something along these lines)
  • Then in VL, if the banner has _smush over-ride the default banner (much like Premium to Regular members)
  • Possible deletion of older banner? Space saver for larger lists.
Just throwing some suggestions out there. I have no experience in this sort of field so I have no idea if this is even feasible.
 

Basti

Administrator
Staff member
No idea yet for smush it on my end but

"Possible deletion of older banner? Space saver for larger lists."
This was actually an old time request when you delete members. Think it has not been integrated yet. Going to push that into 1.3 now
 

CrazyCoder

Member
1) use cloudflare
2) put all caching possibilities needed rules to ur .htaccess, by example :

Code:
# disable the server signature- helps with preformance
ServerSignature Off



## contrôle du cache navigateur - Expire headers
<IfModule mod_expires.c>
    ExpiresActive On
    ExpiresDefault "access plus 7200 seconds"
    ExpiresByType image/jpg            "access plus 1 week"
    ExpiresByType image/jpeg            "access plus 1 week"
    ExpiresByType image/png            "access plus 1 week"
    ExpiresByType image/gif            "access plus 1 week"
    AddType image/x-icon .ico
    ExpiresByType image/ico            "access plus 1 week"
    ExpiresByType image/icon            "access plus 1 week"
    ExpiresByType image/x-icon          "access plus 1 week"
    ExpiresByType text/css              "access plus 1 week"
    ExpiresByType text/javascript      "access plus 1 week"
    ExpiresByType text/html            "access plus 0 seconds"
    ExpiresByType application/xhtml+xml    "access plus 0 seconds"
    ExpiresByType application/javascript    "access plus 1 week"
    ExpiresByType application/x-javascript  "access plus 1 week"
    ExpiresByType application/x-shockwave-flash "access plus 1 week"
</IfModule>


<IfModule mod_headers.c>
<FilesMatch "\\.(ico|jpg|jpeg|png|gif|swf)$">
Header set Cache-Control "max-age=2592000, public"
</FilesMatch>
<FilesMatch "\\.(css)$">
Header set Cache-Control "max-age=604800, public"
</FilesMatch>
<FilesMatch "\\.(js)$">
Header set Cache-Control "max-age=216000, private"
</FilesMatch>
<FilesMatch "\\.(x?html?|php)$">
Header set Cache-Control "max-age=0, private, must-revalidate"
</FilesMatch>
</IfModule>
3) i've been using GZIP for years, my compression rate is in average : 82% !!!

3 very simple solutions to dramatically improve ur page loads, and save ur server


EDIT : => check ur site using the W3C checker, u'll be surprised about how much deprecated html tag u still using !
unused CSS definitions u get => always get rid of duplicate or unused CSS, get rid of unused or unecessary JS too, use minified js versions as possible, pay attention to ur files call combinations, mainly call all csss files first, then all js, ...

this can reduce also ur bandwitch use

optimized ur css, as example , this :
Code:
legend {
    margin: 5px 0;
    padding: 3px 10px;
    background: #2b567f;
    color: #ccc;
    border-radius: 7px;
    width: 80%;
}
should be optimized this way :
Code:
legend{margin:5px 0;padding:3px 10px;background:#2b567f;color:#ccc;border-radius:7px;width:0%}
notice : after the final css tag, dont put the ";"before the "}"
why ? coz the interpreter will more quickly understand this css definition is about to end, the closing tag coming...

there are a tons of way to really improve our websites, on OUR sides :)
 
Last edited:
Top