Post Reply 
[Req]image size limit
Jul. 27, 2008, 08:44 PM
Post: #1
[Req]image size limit
Is it possible for proxomitron to only load images that its size is lower than a specific limit, or only load the image until a specific size is reached.
this will help speed loading pages that contains uncompressed images or large size images.
if its possible i would like to request the filter code for this process.
and define the filter for every format.
for example:
if the image is jpg---dont load images over 100KB or stop loading the image when 100KB is downloaded.
if the image is png---dont load images over 300KB or stop loading the image when 300KB is downloaded.

I am not expert in any programming language or proxomitron advance settings so i hope someone with experience would help me.
thanks in advance.
Add Thank You Quote this message in a reply
Jul. 28, 2008, 02:58 PM
Post: #2
RE: [Req]image size limit
here's one that blocks an image if it is above a pre-set size...
Code:
In = TRUE
Out = FALSE
Key = "Content-Type: 5d Kill Large Images (In) [add]"
URL = "$TST(volat=*.clength:[#100000:*].*)"
Match = "image/"
Replace = "\k"
Add Thank You Quote this message in a reply
Jul. 28, 2008, 08:20 PM
Post: #3
RE: [Req]image size limit
Here's a generic header filter that kills by type/size:

Code:
[HTTP headers]
In = TRUE
Out = FALSE
Key = "Zap-Image: Kill Big Images (In)"
URL = "$RESP(2)(^local.ptron)"
Match = "(^?)$IHDR(Content-Length: ?*&\0)$IHDR(Content-Type: image/$LST(ImgSize))"
Replace = "Image to Big \k$RDIR(http://local.ptron/killed.gif)"

Here's the contents of $LST(ImgSize) used in the above filter:
Code:
#

png        $TST(\0=[#300000:*])
jpeg        $TST(\0=[#100000:*])

#
Add/Modify list entries as required.

HTH
z12
Add Thank You Quote this message in a reply
Jul. 28, 2008, 09:09 PM
Post: #4
RE: [Req]image size limit
thank you all

how can i add a link to the replaced image which refere to the original image.
Add Thank You Quote this message in a reply
Jul. 29, 2008, 12:49 AM
Post: #5
RE: [Req]image size limit
Here's a modified version that works with Firefox/2.0.0.16.
Not sure about other browsers.

Mouse over the image, right click, then click "View Image".
The image will still be blank (or your $REDIR() image).
Hold down the "v" key, then reload the image.
The image should appear.
If not, hold down the shift key while reloading.

It's a bit cumbersome, but off the top of my head, that's all I got.

Code:
[HTTP headers]
In = TRUE
Out = FALSE
Key = "Zap-Image: Kill Big Images (In)"
URL = "(^$KEYCHK(v))$RESP(2)(^local.ptron)"
Match = "(^?)$IHDR(Content-Length: ?*&\0)$IHDR(Content-Type: image/$LST(ImgSize))"
Replace = "Image to Big \k$RDIR(http://local.ptron/killed.gif)"

z12
Add Thank You Quote this message in a reply
Post Reply 


Forum Jump: