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

Re: [mod_perl2] ImageMagick 'convert'

Expand Messages
  • Stas Bekman
    ... You can always inline image using uuencoded or similar ascii friendly encoding. cat /usr/share/doc/perl-IO-stringy-2.108/icons/itembullet.gif | perl -0777
    Message 1 of 3 , Apr 11, 2003
      > SB> Your case still includes things that I don't have, references to some
      > SB> images... can you trim it down to something that can be used as is? it'd be
      > SB> nice to add this test to mp2 test suite. Some heavy apps are good for testing.
      >
      > I'm afraid I can't trim it down to exclude the images, as
      > this is an image-based test. But any image will do, and I've
      > tried to make it easy by putting the paths in obvious variables at the top.

      You can always inline image using uuencoded or similar ascii friendly encoding.

      cat /usr/share/doc/perl-IO-stringy-2.108/icons/itembullet.gif | perl -0777 -e
      'print pack("u", <>)' | perl -0777 -e 'print unpack "u", <>' > out.gif

      so you convert the binary image into a uuencoded string:

      $ cat foo.gif | perl -0777 -e 'print pack("u", <>)'
      M1TE&.#=A#P`.`*$``/CX^/C\^*@L4.#DX"P`````#P`.```"'801J7JV'QJ$
      7;KYJ<Q):B=]]8B:6V8"F0\>V+-(6`#L`

      (-0777 is the same as 'local $/' to slurp the whole thing in)


      Now you inline this uuencoded string into a variable in your test and convert
      it to the binary format at run time:

      ...
      $uuencoded = <<EOUU;
      M1TE&.#=A#P`.`*$``/CX^/C\^*@L4.#DX"P`````#P`.```"'801J7JV'QJ$
      7;KYJ<Q):B=]]8B:6V8"F0\>V+-(6`#L`
      EOUU
      $binary = unpack("u", $uuencoded);

      then you can send this image as if it was a file on the disk.


      > SB> Also you don't say anything about your perl build specifics, neither you
      >
      > Beg pardon: now attached to the end of this mail.

      perl -V is not enough, I ask people to follow the guidelines for a reason :)
      http://perl.apache.org/docs/2.0/user/help/help.html#Reporting_Problems

      also the next version of mp2 will sport mp2bug script (it's in cvs already).

      > SB> mention which ImageMagic lib version do you use and which I::M Perl lib you
      > SB> have the trouble with. See:
      > SB> http://perl.apache.org/docs/2.0/user/help/help.html#Reporting_Problems
      >
      > The very latest: 556 Q16, the official Windows distribution. Whilst
      > this IM builds fine, I can't get PerlMagick to build (didn't try very
      > hard) so can't say if it's okay with Q8. I do know that it's fine with
      > Apache/mp 1, but then the problem only seems to be with multiple
      > synchronous requests. Debug is not enabled on the official release.

      Dunno if I get to build it. May be tomorrow. Meanwhile a self-containing test
      would be cool.

      > SB> May be we will have a better luck, with Filter::CBC as it doesn't rely on any
      > SB> external libs (I think).
      >
      > Filter::CBC is okay with TwoFish, it's the default Rj that messes it
      > up.

      Is it hard to write a short test? I haven't used Filter::CBC yet. So I won't
      have to mess with the magic install.

      > Also - in the logs quoted in that previous mail, there's an
      > interesting warning about v-string not being portable...?

      probably complaining about:

      our $VERSION = 0.1;

      does it help to use "0.1"?

      > Thanks for your help and interest, Stas. If I ever get this thing
      > working and earning money, there'll defiantly be donations to the
      > foundation.

      Cool!

      __________________________________________________________________
      Stas Bekman JAm_pH ------> Just Another mod_perl Hacker
      http://stason.org/ mod_perl Guide ---> http://perl.apache.org
      mailto:stas@... http://use.perl.org http://apacheweek.com
      http://modperlbook.org http://apache.org http://ticketmaster.com
    Your message has been successfully submitted and would be delivered to recipients shortly.