www-apache-bugdb mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Peter Whiting <p...@whitings.org>
Subject mod_autoindex/7446: per image thumbnails for icons in autoindex
Date Wed, 21 Mar 2001 15:36:34 GMT

>Number:         7446
>Category:       mod_autoindex
>Synopsis:       per image thumbnails for icons in autoindex
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    apache
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   apache
>Arrival-Date:   Wed Mar 21 07:40:04 PST 2001
>Closed-Date:
>Last-Modified:
>Originator:     pete@whitings.org
>Release:        1.3.19
>Organization:
apache
>Environment:
Linux tiny 2.2.14-5.0 #1 Tue Mar 7 20:53:41 EST 2000 i586 unknown
>Description:
I modified mod_autoindex to use, as icons, thumbnails of each image.

demo at: http://fury.ittc.ukans.edu:8080/demo/

The config for this looks like:
AddIconByType (IMG,/cgi-bin/thumb?%s) image/*

if you cgi script is cooler than mine:
AddIconByType (IMG,/cgi-bin/coolthumb?file=%s&size=100x100) image/*

Basically, if you put a %s in the icon name, it will be replaced with
the filename.  Ugly hack - just use sprintf.

*** mod_autoindex.c     Wed Mar 21 09:02:59 2001
--- mod_autoindex.c.orig        Mon Jan 15 11:05:38 2001
***************
*** 763,774 ****
                        if (content_type
                            && !ap_strcasecmp_match(content_type,
                                                    p->apply_to)) {
-                             if(strstr(p->data,"%s")) {
-                               int n=strlen(p->data)+strlen(r->uri)+2;
-                               char *tn = (char *)ap_pcalloc(r->main->pool,n); 
-                               ap_snprintf(tn,n-1,p->data,r->uri);
-                               return tn;
-                             }
                            return p->data;
                        }
                    }
--- 763,768 ----

Here is my thumb cgi script.  Let me know if it has massive security flaws,
as I expect it does...

#!/usr/bin/perl
$dir="/usr/local/apache/htdocs";
$_=$ENV{QUERY_STRING};
exit if /(\.\.)|\;|\&|\|/; # only should allow normal filenames
s/(\/\/+)/\//g;
$file="thumb_$_"; #cache this thing
$file=~s/\//_/g;
$file="/tmp/thumbnails/${file}.jpg";
system("convert -geometry 100 \"$dir/$_\" \"$file\"") if not -f $file;
print "Content-type: image/jpeg\n\n";
print `cat $file`; 
>How-To-Repeat:
http://fury.ittc.ukans.edu:8080/demo/
>Fix:
see above
>Release-Note:
>Audit-Trail:
>Unformatted:
 [In order for any reply to be added to the PR database, you need]
 [to include <apbugs@Apache.Org> in the Cc line and make sure the]
 [subject line starts with the report component and number, with ]
 [or without any 'Re:' prefixes (such as "general/1098:" or      ]
 ["Re: general/1098:").  If the subject doesn't match this       ]
 [pattern, your message will be misfiled and ignored.  The       ]
 ["apbugs" address is not added to the Cc line of messages from  ]
 [the database automatically because of the potential for mail   ]
 [loops.  If you do not include this Cc, your reply may be ig-   ]
 [nored unless you are responding to an explicit request from a  ]
 [developer.  Reply only with text; DO NOT SEND ATTACHMENTS!     ]
 
 


Mime
View raw message