php and images

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Martin Herrman

    php and images

    Hi all,

    I'm writing a module for a Content Management System called 'Site@School'
    (siteatschool.s f.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
  • Jason

    #2
    Re: php and images

    "Martin Herrman" <m.herrman@stud ent.tue.nl> wrote in message
    news:pan.2003.1 0.09.15.19.22.4 61323@student.t ue.nl...[color=blue]
    > Hi all,
    >
    > I'm writing a module for a Content Management System called 'Site@School'
    > (siteatschool.s f.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
    >[/color]

    Run imagemagick from the command line instead of using an extension.


    Comment

    • Martin Herrman

      #3
      Re: php and images

      On Thu, 09 Oct 2003 18:04:16 +0000, Jason wrote:
      [color=blue]
      > Run imagemagick from the command line instead of using an extension.[/color]

      it's so simple :-)

      Thanks!

      Martin

      Comment

      • Justin Koivisto

        #4
        Re: php and images

        Jason wrote:
        [color=blue]
        > "Martin Herrman" <m.herrman@stud ent.tue.nl> wrote in message
        > news:pan.2003.1 0.09.15.19.22.4 61323@student.t ue.nl...
        >[color=green]
        >>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[/color]
        >
        > Run imagemagick from the command line instead of using an extension.[/color]

        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_exist s('imagecreatef romjpeg'){
        // 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_exist s('imagecreatef rompng'){
        // 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=sys tem('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 - spam@koivi.com
        PHP POSTERS: Please use comp.lang.php for PHP related questions,
        alt.php* groups are not recommended.

        Comment

        Working...