Loading ...
Sorry, an error occurred while loading the content.
 

Re: Image::Size and Location

Expand Messages
  • Randy J. Ray
    ... (A better first step would have been to write me at the maintainer address in the documentation. Luckily, I read this list as well. :-) The main reason
    Message 1 of 2 , Apr 28, 2003
      > I would like to use Image::Size based on a Location instead of using it
      > on a file. Is there a way to do URI trans. (and may be content
      > negotiation) without doing a subrequest? What is the best way to do
      > this, if not?

      (A better first step would have been to write me at the maintainer address in
      the documentation. Luckily, I read this list as well. :-)

      The main reason that I've never put anything like this directly into the API
      is that the specification of things like the document root differ across
      different http servers. And even under Apache, the ultimate path can be
      affected by aliases, rewrite rules, etc.

      My recommendation to users under mod_perl is to use the sub-request mechanism.
      Citing from the Apache(1) manpage:

      SUB REQUESTS
      Apache provides a sub-request mechanism to lookup a uri or
      filename, performing all access checks, etc., without
      actually running the response phase of the given request.
      Notice, we have dropped the "sub_req_" prefix here. The
      "request_rec*" returned by the lookup methods is blessed
      into the Apache::SubRequest class. This way,
      "destroy_sub_request()" is called automatically during
      "Apache::SubRequest->DESTROY" when the object goes out of
      scope. The Apache::SubRequest class inherits all the
      methods from the Apache class.

      $r->lookup_uri($uri)
      my $subr = $r->lookup_uri($uri);
      my $filename = $subr->filename;

      unless(-e $filename) {
      warn "can't stat $filename!\n";
      }

      $r->lookup_file($filename)
      my $subr = $r->lookup_file($filename);

      (Which of the two you use would depend on your circumstances.)

      Hope this helps.

      Randy
      --
      -------------------------------------------------------------------------------
      Randy J. Ray | Men occasionally stumble over the truth, but most of them
      rjray@... | pick themselves up and hurry off as if nothing had happened.
      +1 650 930-9097 | -- Sir Winston Churchill
    Your message has been successfully submitted and would be delivered to recipients shortly.