Do you know how -- or whether -- the thumbnail file will be identified in the QUERY_STRING parameters? (It looks like the full image file is named by a parameter called "FILE1" ("FILE2",...) -- will the name of the thumbnail file be predictable from the values of these parameters, or are there other parameters for the thumbnail files? Or are the names of full and thumbnail files interleaved in this set of parameters, e.g. FILE1 is full, FILE2 is thumbnail?) If you don't know, you need to figure that out. Then the rest will be pretty easy.

As it stands, the code is reading a full-image file from whatever path is provided in the "FILE$a" parameters, and copying it to the directory specified by "$ENV{DOCUMENT_ROOT}", which is the value being assigned to $Photo_Dir.

Let's assume that a thumbnail file ends up being one of the "FILE$a" parameters. If you declare a variable like "$Thumb_Dir", with a suitable value, and figure out how to identify an input thumbnail file, you'll probably end up altering the "open(OUTFILE...)" line a bit and adding one extra instruction just before that, something like the following:

... my $filename = ( $full_image ) ? "$Photo_Dir/$filename" : "$Thumb_dir/th_$filename"; if(open(OUTFILE, ">$filename")) { while (my $bytesread = read($file, my $buffer, 1024)) { print OUTFILE $buffer; } close (OUTFILE); ...

P.S.: Lighten up on merlyn. What he said was true -- you were presenting code written by someone else (though not all of it -- you missed a closing curly brace), and you did not state the problem clearly enough for anyone to give you a solid answer (that's why my response had so many questions in it.) It's both entirely possible and fully correct to interpret his response as meaning no personal offense. (For that matter, considering the amount of redundant and/or unnecessary code in this script, saying that someone else must have written it could have be taken as a compliment...)


In reply to Re: Adding directory to code by graff
in thread Adding directory to code by cal

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.