You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Barry Boyce <ba...@gmail.com> on 2006/03/02 16:02:12 UTC

[users@httpd] mod_ext_filter And ImageMagick Proxy

Hey, I've been trying lately to get a forward proxy to recompress
images on-the-fly using mod_ext_filter and ImageMagicks "convert"
program.  Here is the virtualhost I have set up for it in my
httpd.conf.  I am removing my ip addr:

<VirtualHost>
ExtFilterDefine imagecompress mode=output outtype=image/jpeg
intype=image/jpeg cmd="/usr/bin/convert - -quality 35 -"
servername ipaddr
ProxyRequests On
<Proxy *>
	AuthType Basic
	AuthName "Proxy"
	Require user dbn
	AuthUserFile /var/www/passwd
	Order Deny,Allow
	Allow from All
</Proxy>
DeflateMemLevel 8
DeflateCompressionLevel 8
DeflateBufferSize 4000
# SetEnvIfNoCase Request_URI \
#	\.(?:gif|jpe?g|png)$ no-gzip dont-vary
#DeflateFilterNote Input instream
#DeflateFilterNote Output outstream
#DeflateFilterNote Ratio ratio

#LogFormat '"%r" %{outstream}n/%{instream}n (%{ratio}n%%)' deflate
#CustomLog logs/deflate_log deflate
#AddOutputFilter DEFLATE html txt shtml php asp pl jsp
#AddOutputFilter imagecompress jpg jpeg
SetOutputFilter imagecompress

# mod_mime directive to set the type of .c
# files to text/c
AddType image/jpeg .jpeg .jpg
</VirtualHost>

Adding the type before the external filter didn't work so AddType is
at the bottom.  It filters out anything but jpg's but when it does the
recompressing it always garbles them or something.  My
webbrowser(firefox) can't display anything for them.  I believe
convert's output is getting cut short or somehow apache is piping it
wrong.

Converting a jpeg with the command "cat test.jpg | convert - -quality
35 - > test2.jpg" works just fine.

BTW, The deflate was in there originally in there for compressing all
output.  I thought a image compressing add-on would be nice.

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org