logo
Apache Lounge
Webmasters

 

About Forum Index Downloads Search Register Log in RSS X


Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.

or

Bitcoin

A donation makes a contribution towards the costs, the time and effort that's going in this site and building.

Thank You! Steffen

Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
Post new topic   Forum Index -> Apache View previous topic :: View next topic
Reply to topic   Topic: Any way to shrink or compress images?
Author
csdude55



Joined: 22 Jan 2023
Posts: 23
Location: USA, Wilkesboro

PostPosted: Wed 10 Jul '24 21:30    Post subject: Any way to shrink or compress images? Reply with quote

I use this in my Apache .CONF to force compression on all text output:

Code:
<IfModule mod_deflate.c>
    AddOutPutFilterByType DEFLATE text/html text/plain text/css text/javascript application/javascript application/x-javascript text/xml application/xml application/xml+rss application/vnd.ms-fontobject application/x-font-ttf

    <IfModule mod_setenvif.c>
        BrowserMatch ^Mozilla/4 gzip-only-text/html
        BrowserMatch ^Mozilla/4\.0[678] no-gzip
        BrowserMatch \bMSI[E] !no-gzip !gzip-only-text/html
       
        SetEnvIfNoCase Request_URI .(?:gif|jpe?g|png)$ no-gzip dont-vary
    </IfModule>

    <IfModule mod_headers.c>
        Header append Vary User-Agent env=!dont-vary
    </IfModule>
</IfModule>


You can see, though, that it explicitly ignores images.

Some of my hosting accounts upload images to their sites that are HUGE! They're obviously taking the photo in high resolution and resizing it via Wordpress or something, but the source is over 15MB.

Is there anything I can do via Apache to automatically shrink images to, say, a maximum of 2000px in width? Or a maximum of 1MB in filesize?
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7374
Location: Germany, Next to Hamburg

PostPosted: Mon 15 Jul '24 22:00    Post subject: Reply with quote

Apache does not have such a module or function. You may want to use an external tool like imagick.
Back to top


Reply to topic   Topic: Any way to shrink or compress images? View previous topic :: View next topic
Post new topic   Forum Index -> Apache