From: email@hidden
Reply-To: email@hidden
To: email@hidden
CC: email@hidden, email@hidden
Subject: Re: ImageMagick & WO - Resizing Images On The Fly
Date: Fri, 27 Jun 2003 12:59:21 CDT
I am currently at WWDC, and will be on vacation for two weeks starting
Monday, so won't
be back in the office to look at my code and respond to you for a couple
weeks.
However...
On Fri, 27 Jun 2003 09:03:56 +0100 "Jonathan Fleming" wrote:
> 1) How much is involved in building imageMagick and are there any
> particular
> bugs or workarounds to be aware when compiling it?
On Windows, I just downloaded the pre-built ImageMagick, and it worked
fine, I didn't
need to build it.
On Solaris, however, the pre-built binary did not work, and I did indeed
have QUITE a bit
of trouble getting it compiled properly. However, I know very little
about compiling C stuff
on Solaris. Someone with more experience may have less trouble. I also do
not have 'root'
on the machine I was compiling on, which made things even trickier.
But yeah, it was actually quite dificult to get things compiled. The main
thing to be aware of
is that the bare-bones ImageMagick build will not include support for
various neccesary
image formats (like JPG!). Getting it compiled with the optional
packages to support all
standard image formats was tricky.
> 2) What are the server side things that need to be done or is this all
in
> the development machine or Java code?
I am using the ImageMagick command line utilities, NOT the Java
ImageMagick API. Just
calling command line utilities with Runtime.exec, whether on Windows or
Solaris.
The only server-side trick was making sure the ImageMagick utilities were
in the PATH of
the process running my WO app, and that the LD_LIBRARY_PATH env variable
was
properly set. If you had root on the machine and were able to install
ImageMagick in the
default system-wide location, this might not be an issue.
What I finally ended up doing to get that working, was putting the
environmental variable
declerations ('export') in the WOTaskd start script, so that all WO
processes had the proper
env variables.
> 3) Are there any problems with getting images to resize when users
> put their
> images up through a WOFileUpload component for example, or is it
> better some
> other way?
>
What I do, is the users use WOFileUpload, and I stream the file to disk.
Once the file is on
disk, I call the ImageMagick command line utils with the filepath of the
file on disk. No
problem. Regardless of how the file GOT there, once it's on disk, no
problem.
It should theoretically be possible to use the ImageMagick command line
utilities to
operate on a file that's just in memory, not even on disk, using the
stdin and stdout
streams. But this would be more trouble than it's worth unless you know
exactly what
you're doing (I don't, with this stuff!), and really need it. just put
the file on disk, no
problem.
> 4) Is there any particular code or workarounds that I should look out
> for or
> know of? If so, can you possibly post examples?
>
Only what I've already mentioned. Now that I have it working, it works
beautifully. Oh, one
more thing: when resizing, make sure you give ImageMagick the argument
to _strip_ out
all 'profile' information from an output JPG. The example command at the
top of the
ImageMagick 'convert' documentation includes this argument. The
'profile' information in
the JPG is unneccesary, and was causing problems for IE on Windows.
> 5) Lastley, if there is anything else I could benefit from knowing
> regarding
> all aspects of using Image Magick with WebObjects, I would greatly
> appriciate your enlightenment.
>
I think that's everything I know. My deployment is Solaris, so you may
have slightly
different issues on Windows. I do have ImageMagick working for my dev
environment on
Windows, but I haven't tried to get it working for Monitor-deployed apps
on Windows.
When i am back at work in a couple weeks, if you remind me, I can post
more detailed
information if you still need it. Good luck.
--Jonathan
> I'm using WebObjects 5.1.2 on a Windows2000 platform
>
> Kind regards
> Jonathan F :^)
>
> _________________________________________________________________
> Hotmail messages direct to your mobile phone
> http://www.msn.co.uk/msnmobile
>