Jason wrote:
"Martin Herrman" <m.*******@student.tue.nl> wrote in message
news:pa****************************@student.tue.nl ...
Hi all,
I'm writing a module for a Content Management System called 'Site@School'
(siteatschool.sf.net). One of it's requirements is that if any other
software package is used, it must be invisible to the user.
Now I need to resize jpeg and gif images. When I use php extensions like
imagick.so or the gd-lib one, I cannot include them into the module. The
user that installs the module (which can be a school on their ISP's
webspace) must also install the extensions and adapt the sytem's php.ini
file (which is impossible if you don't have root access).
I know recent php versions can be compiled with the --enable-gd option,
but I'm not allowed to make that assumption (maybe an ISP doesn't want it
to enable because of possible security problems for example).
Do you know any solution to this problem? (it should be possible, although
not trivial, to compile and install a package in ones homedirectory)
much thanks in advance,
Martin
Run imagemagick from the command line instead of using an extension.
Actually, the way I do it is to first see if GD is compiled in. Since I
only use jpeg or png images, I check for functions that relate to those
image types.
if($image_type=='jpeg' && !function_exists('imagecreatefromjpeg'){
// GD is not installed with jpeg support, use image magick
}else if($image_type=='jpeg'){
// use GD to resize the image
}else if($image_type=='png' && !function_exists('imagecreatefrompng'){
// GD is not installed with pngsupport, use image magick
}else if($image_type=='png'){
// use GD to resize the image
}
This way, if GD is installed, you can simply use it. On the other hand,
if you need to use imagemagick (from the command line), you need to know
where on the server it is installed. Sometimes this is as trivial as
doing a $im_convert=system('which convert'); However, if IM isn't in the
path, then you'd have to specify where it is on the system.
HTH
--
Justin Koivisto -
sp**@koivi.com
PHP POSTERS: Please use comp.lang.php for PHP related questions,
alt.php* groups are not recommended.