ImageMagick probz in PHP

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Roger Godefroy

    ImageMagick probz in PHP

    Hi there,

    Just a little problem I guess... I have stripped out just an imageresize
    string for ImageMagic in a php-file:

    <?
    exec('convert -quality 100 -antialias -sample 100x100
    /var/www/html/aftermath2.jpg /var/www/html/thumb_aftermath .jpg');
    ?>

    The string would work in a shell, but not using the above php-file. Any
    idea's?

    Greetz,

    Roger


  • uws

    #2
    Re: ImageMagick probz in PHP

    I <bfohnt$fgp$1@n ews3.tilbu1.nb. home.nl>, Roger Godefroy skrev:[color=blue]
    > Just a little problem I guess... I have stripped out just an imageresize
    > string for ImageMagic in a php-file:
    ><?
    > exec('convert -quality 100 -antialias -sample 100x100
    > /var/www/html/aftermath2.jpg /var/www/html/thumb_aftermath .jpg');
    > ?>
    > The string would work in a shell, but not using the above php-file. Any
    > idea's?[/color]

    Do you have write permission in the given directory?

    mvrgr, Wouter

    --
    :wq mail uws@xs4all.nl

    don't just call me pessimist :: try and read between the lines -- tool

    Comment

    • Roger Godefroy

      #3
      Re: ImageMagick probz in PHP

      CHMODded the folder and files allready to 777. But no result... Any other
      ideas? On another server it works however perfectly using the script
      (without resize):

      <?php
      exec("convert -quality 100 aftermath2.jpg thumb_aftermath .jpg");
      ?>

      But on this new server it won't ??? Strange isn't it?

      "uws" <uws@xs4all.inv alid> schreef in bericht
      news:your-advertisement-here-call-20030724122237@ klikmans.nl...[color=blue]
      > I <bfohnt$fgp$1@n ews3.tilbu1.nb. home.nl>, Roger Godefroy skrev:[color=green]
      > > Just a little problem I guess... I have stripped out just an imageresize
      > > string for ImageMagic in a php-file:
      > ><?
      > > exec('convert -quality 100 -antialias -sample 100x100
      > > /var/www/html/aftermath2.jpg /var/www/html/thumb_aftermath .jpg');
      > > ?>
      > > The string would work in a shell, but not using the above php-file. Any
      > > idea's?[/color]
      >
      > Do you have write permission in the given directory?
      >
      > mvrgr, Wouter
      >
      > --
      > :wq mail[/color]
      uws@xs4all.nl[color=blue]
      >
      > don't just call me pessimist :: try and read between the lines --[/color]
      tool


      Comment

      • Shawn Wilson

        #4
        Re: ImageMagick probz in PHP


        Roger Godefroy wrote:
        [color=blue]
        > Just a little problem I guess... I have stripped out just an imageresize
        > string for ImageMagic in a php-file:
        >
        > <?
        > exec('convert -quality 100 -antialias -sample 100x100
        > /var/www/html/aftermath2.jpg /var/www/html/thumb_aftermath .jpg');
        > ?>
        >
        > The string would work in a shell, but not using the above php-file. Any
        > idea's?[/color]

        When you tried it in the shell, did you use the exact same file in the exact
        same directory?
        Do you get any error messages (use -debug and -log)? Just some
        guesses/suggestions:

        Are you 100% certain the path is correct (did you blindly copy path from old
        server)?
        Is the original file at least 100x100?
        Try 'convert /var/www/html/aftermath2.jpg
        /var/www/html/thumb_aftermath .jpg'. That'll at least confirm it's not the
        sample, quality or antialias.
        Make sure /var/www/html/thumb_aftermath .jpg doesn't exist (could have
        trouble replacing).
        If you have SSH or Telnet access to the server, try just running the
        command.
        Try with a different image type. I had a helluva time with PNGs - IM was
        configured wrong.

        Shawn
        --
        Shawn Wilson
        shawn@glassgian t.com



        Comment

        • Roger Godefroy

          #5
          Re: ImageMagick probz in PHP

          > > Just a little problem I guess... I have stripped out just an
          [color=blue][color=green]
          > > imageresize string for ImageMagic in a php-file:[/color][/color]
          [color=blue][color=green]
          > >[/color][/color]
          [color=blue][color=green]
          > > <?[/color][/color]
          [color=blue][color=green]
          > > exec('convert -quality 100 -antialias -sample 100x100[/color][/color]
          [color=blue][color=green]
          > > /var/www/html/aftermath2.jpg /var/www/html/thumb_aftermath .jpg');[/color][/color]
          [color=blue][color=green]
          > > ?>[/color][/color]
          [color=blue][color=green]
          > >[/color][/color]
          [color=blue][color=green]
          > > The string would work in a shell, but not using the above php-file.[/color][/color]
          [color=blue][color=green]
          > > Any idea's?[/color][/color]
          [color=blue]
          >[/color]
          [color=blue]
          > When you tried it in the shell, did you use the exact same file in the[/color]
          [color=blue]
          > exact same directory?[/color]

          Yupz... in the same folder as the php-script and jpg-file using the exact
          string as in the php-file.
          [color=blue]
          > Do you get any error messages (use -debug and -log)? Just some[/color]
          [color=blue]
          > guesses/suggestions:[/color]
          [color=blue]
          >[/color]
          [color=blue]
          > Are you 100% certain the path is correct (did you blindly copy path[/color]
          [color=blue]
          > from old server)?[/color]

          Also without the path it would work on the "old" server. On the new server,
          it wouldn't work with the full path /var/www/html or just the filename.
          [color=blue]
          > Is the original file at least 100x100?[/color]

          Original file is 1600x1200
          [color=blue]
          > Try 'convert /var/www/html/aftermath2.jpg[/color]
          [color=blue]
          > /var/www/html/thumb_aftermath .jpg'. That'll at least confirm it's not[/color]
          [color=blue]
          > the sample, quality or antialias.[/color]

          Also no output. However executing in a shell, it would...
          [color=blue]
          > Make sure /var/www/html/thumb_aftermath .jpg doesn't exist (could have[/color]
          [color=blue]
          > trouble replacing).[/color]

          File not existing...
          [color=blue]
          > If you have SSH or Telnet access to the server, try just running the[/color]
          [color=blue]
          > command. Try with a different image type. I had a helluva time with[/color]
          [color=blue]
          > PNGs - IM was configured wrong.[/color]

          Also when testing with a .gif, no result... :(

          Any other ideas?

          Greetings,

          Roger Godefroy


          Comment

          • Shawn Wilson

            #6
            Re: ImageMagick probz in PHP



            Roger Godefroy wrote:
            [color=blue][color=green][color=darkred]
            > > > Just a little problem I guess... I have stripped out just an[/color][/color]
            >[color=green][color=darkred]
            > > > imageresize string for ImageMagic in a php-file:[/color][/color]
            >[color=green][color=darkred]
            > > >[/color][/color]
            >[color=green][color=darkred]
            > > > <?[/color][/color]
            >[color=green][color=darkred]
            > > > exec('convert -quality 100 -antialias -sample 100x100[/color][/color]
            >[color=green][color=darkred]
            > > > /var/www/html/aftermath2.jpg /var/www/html/thumb_aftermath .jpg');[/color][/color]
            >[color=green][color=darkred]
            > > > ?>[/color][/color]
            >[color=green][color=darkred]
            > > >[/color][/color]
            >[color=green][color=darkred]
            > > > The string would work in a shell, but not using the above php-file.[/color][/color]
            >[color=green][color=darkred]
            > > > Any idea's?[/color][/color]
            >[color=green]
            > >[/color]
            >[color=green]
            > > When you tried it in the shell, did you use the exact same file in the[/color]
            >[color=green]
            > > exact same directory?[/color]
            >
            > Yupz... in the same folder as the php-script and jpg-file using the exact
            > string as in the php-file.
            >[color=green]
            > > Do you get any error messages (use -debug and -log)? Just some[/color]
            >[color=green]
            > > guesses/suggestions:[/color]
            >[color=green]
            > >[/color]
            >[color=green]
            > > Are you 100% certain the path is correct (did you blindly copy path[/color]
            >[color=green]
            > > from old server)?[/color]
            >
            > Also without the path it would work on the "old" server. On the new server,
            > it wouldn't work with the full path /var/www/html or just the filename.
            >[color=green]
            > > Is the original file at least 100x100?[/color]
            >
            > Original file is 1600x1200
            >[color=green]
            > > Try 'convert /var/www/html/aftermath2.jpg[/color]
            >[color=green]
            > > /var/www/html/thumb_aftermath .jpg'. That'll at least confirm it's not[/color]
            >[color=green]
            > > the sample, quality or antialias.[/color]
            >
            > Also no output. However executing in a shell, it would...
            >[color=green]
            > > Make sure /var/www/html/thumb_aftermath .jpg doesn't exist (could have[/color]
            >[color=green]
            > > trouble replacing).[/color]
            >
            > File not existing...
            >[color=green]
            > > If you have SSH or Telnet access to the server, try just running the[/color]
            >[color=green]
            > > command. Try with a different image type. I had a helluva time with[/color]
            >[color=green]
            > > PNGs - IM was configured wrong.[/color]
            >
            > Also when testing with a .gif, no result... :([/color]

            Hmmm...

            Did you try the log?

            Maybe try something simple, like
            passthru("ls -l /var/www/html/");

            If you get a list of stuff in that directory, try passthru with your convert
            command...

            Maybe this is on the right track:
            From PHP.net (exec function)
            Note that when in 'Safe Mode' you must have the script or program you are
            trying to execute in the 'safe_mode_exec _dir'. You can find out what this
            directory is by using phpinfo().

            HTH,
            Shawn

            --
            Shawn Wilson
            shawn@glassgian t.com



            Comment

            • Roger Godefroy

              #7
              Re: ImageMagick probz in PHP

              Hi,



              I got a result using the ls-command. But not using the convert-command. The
              server isn't in safe mode (checked using phpinfo()). I just got the server
              error-log:



              ----[ SNAP ]----

              [2003-07-24 15:56:12]: info: (real/target/actual) uid: (admin7/admin/admin)
              gid:

              (admin7/admin/admin) cmd: php-script alt_doc_root:
              /home/virtual/site7/fst/var/

              www chroot: 1

              [2003-07-24 15:56:28]: info: (real/target/actual) uid: (admin7/admin/admin)
              gid:

              (admin7/admin/admin) cmd: php-script alt_doc_root:
              /home/virtual/site7/fst/var/

              www chroot: 1

              [2003-07-24 15:59:59]: info: (real/target/actual) uid: (admin7/admin/admin)
              gid:

              (admin7/admin/admin) cmd: php-script alt_doc_root:
              /home/virtual/site7/fst/var/

              www chroot: 1

              [2003-07-24 16:00:16]: info: (real/target/actual) uid: (admin7/admin/admin)
              gid:

              (admin7/admin/admin) cmd: php-script alt_doc_root:
              /home/virtual/site7/fst/var/

              www chroot: 1

              [2003-07-24 16:02:48]: info: (real/target/actual) uid: (admin7/admin/admin)
              gid:

              (admin7/admin/admin) cmd: php-script alt_doc_root:
              /home/virtual/site7/fst/var/

              www chroot: 1

              [2003-07-24 16:06:06]: info: (real/target/actual) uid: (admin7/admin/admin)
              gid:

              (admin7/admin/admin) cmd: php-script alt_doc_root:
              /home/virtual/site7/fst/var/

              www chroot: 1

              [2003-07-24 16:06:12]: info: (real/target/actual) uid: (admin7/admin/admin)
              gid:

              (admin7/admin/admin) cmd: php-script alt_doc_root:
              /home/virtual/site7/fst/var/

              www chroot: 1

              [2003-07-24 16:10:22]: info: (real/target/actual) uid: (admin7/admin/admin)
              gid:

              (admin7/admin/admin) cmd: php-script alt_doc_root:
              /home/virtual/site7/fst/var/

              www chroot: 1

              ----[/SNAP]----



              Any idea?


              Greetings,



              Roger



              "Shawn Wilson" <shawn@glassgia nt.com> schreef in bericht
              news:3F1FEE12.A 65AF22F@glassgi ant.com...[color=blue]
              >
              >
              > Roger Godefroy wrote:
              >[color=green][color=darkred]
              > > > > Just a little problem I guess... I have stripped out just an[/color]
              > >[color=darkred]
              > > > > imageresize string for ImageMagic in a php-file:[/color]
              > >[color=darkred]
              > > > >[/color]
              > >[color=darkred]
              > > > > <?[/color]
              > >[color=darkred]
              > > > > exec('convert -quality 100 -antialias -sample 100x100[/color]
              > >[color=darkred]
              > > > > /var/www/html/aftermath2.jpg /var/www/html/thumb_aftermath .jpg');[/color]
              > >[color=darkred]
              > > > > ?>[/color]
              > >[color=darkred]
              > > > >[/color]
              > >[color=darkred]
              > > > > The string would work in a shell, but not using the above php-file.[/color]
              > >[color=darkred]
              > > > > Any idea's?[/color]
              > >[color=darkred]
              > > >[/color]
              > >[color=darkred]
              > > > When you tried it in the shell, did you use the exact same file in the[/color]
              > >[color=darkred]
              > > > exact same directory?[/color]
              > >
              > > Yupz... in the same folder as the php-script and jpg-file using the[/color][/color]
              exact[color=blue][color=green]
              > > string as in the php-file.
              > >[color=darkred]
              > > > Do you get any error messages (use -debug and -log)? Just some[/color]
              > >[color=darkred]
              > > > guesses/suggestions:[/color]
              > >[color=darkred]
              > > >[/color]
              > >[color=darkred]
              > > > Are you 100% certain the path is correct (did you blindly copy path[/color]
              > >[color=darkred]
              > > > from old server)?[/color]
              > >
              > > Also without the path it would work on the "old" server. On the new[/color][/color]
              server,[color=blue][color=green]
              > > it wouldn't work with the full path /var/www/html or just the filename.
              > >[color=darkred]
              > > > Is the original file at least 100x100?[/color]
              > >
              > > Original file is 1600x1200
              > >[color=darkred]
              > > > Try 'convert /var/www/html/aftermath2.jpg[/color]
              > >[color=darkred]
              > > > /var/www/html/thumb_aftermath .jpg'. That'll at least confirm it's not[/color]
              > >[color=darkred]
              > > > the sample, quality or antialias.[/color]
              > >
              > > Also no output. However executing in a shell, it would...
              > >[color=darkred]
              > > > Make sure /var/www/html/thumb_aftermath .jpg doesn't exist (could have[/color]
              > >[color=darkred]
              > > > trouble replacing).[/color]
              > >
              > > File not existing...
              > >[color=darkred]
              > > > If you have SSH or Telnet access to the server, try just running the[/color]
              > >[color=darkred]
              > > > command. Try with a different image type. I had a helluva time with[/color]
              > >[color=darkred]
              > > > PNGs - IM was configured wrong.[/color]
              > >
              > > Also when testing with a .gif, no result... :([/color]
              >
              > Hmmm...
              >
              > Did you try the log?
              >
              > Maybe try something simple, like
              > passthru("ls -l /var/www/html/");
              >
              > If you get a list of stuff in that directory, try passthru with your[/color]
              convert[color=blue]
              > command...
              >
              > Maybe this is on the right track:
              > From PHP.net (exec function)
              > Note that when in 'Safe Mode' you must have the script or program you are
              > trying to execute in the 'safe_mode_exec _dir'. You can find out what this
              > directory is by using phpinfo().
              >
              > HTH,
              > Shawn
              >
              > --
              > Shawn Wilson
              > shawn@glassgian t.com
              > http://www.glassgiant.com
              >
              >[/color]


              Comment

              • Roger Godefroy

                #8
                Re: ImageMagick probz in PHP

                I would get an error on the header() row (Internal Server Error 500).

                The paths are also without result...

                Maybe a server-error?

                Greetz...
                "Shawn Wilson" <shawn@glassgia nt.com> schreef in bericht
                news:3F1FF8A2.D B1C5FE8@glassgi ant.com...[color=blue]
                > Roger Godefroy wrote:
                >[color=green]
                > > Hi,
                > >
                > > I got a result using the ls-command. But not using the convert-command.[/color][/color]
                The[color=blue][color=green]
                > > server isn't in safe mode (checked using phpinfo()). I just got the[/color][/color]
                server[color=blue][color=green]
                > > error-log:
                > >
                > > ----[ SNAP ]----
                > >
                > > [2003-07-24 15:56:12]: info: (real/target/actual) uid:[/color][/color]
                (admin7/admin/admin)[color=blue][color=green]
                > > gid:
                > >
                > > (admin7/admin/admin) cmd: php-script alt_doc_root:
                > > /home/virtual/site7/fst/var/
                > >
                > > www chroot: 1
                > >
                > > [2003-07-24 15:56:28]: info: (real/target/actual) uid:[/color][/color]
                (admin7/admin/admin)[color=blue][color=green]
                > > gid:
                > >
                > > (admin7/admin/admin) cmd: php-script alt_doc_root:
                > > /home/virtual/site7/fst/var/
                > >
                > > www chroot: 1
                > >
                > > [2003-07-24 15:59:59]: info: (real/target/actual) uid:[/color][/color]
                (admin7/admin/admin)[color=blue][color=green]
                > > gid:
                > >
                > > (admin7/admin/admin) cmd: php-script alt_doc_root:
                > > /home/virtual/site7/fst/var/
                > >
                > > www chroot: 1
                > >
                > > [2003-07-24 16:00:16]: info: (real/target/actual) uid:[/color][/color]
                (admin7/admin/admin)[color=blue][color=green]
                > > gid:
                > >
                > > (admin7/admin/admin) cmd: php-script alt_doc_root:
                > > /home/virtual/site7/fst/var/
                > >
                > > www chroot: 1
                > >
                > > [2003-07-24 16:02:48]: info: (real/target/actual) uid:[/color][/color]
                (admin7/admin/admin)[color=blue][color=green]
                > > gid:
                > >
                > > (admin7/admin/admin) cmd: php-script alt_doc_root:
                > > /home/virtual/site7/fst/var/
                > >
                > > www chroot: 1
                > >
                > > [2003-07-24 16:06:06]: info: (real/target/actual) uid:[/color][/color]
                (admin7/admin/admin)[color=blue][color=green]
                > > gid:
                > >
                > > (admin7/admin/admin) cmd: php-script alt_doc_root:
                > > /home/virtual/site7/fst/var/
                > >
                > > www chroot: 1
                > >
                > > [2003-07-24 16:06:12]: info: (real/target/actual) uid:[/color][/color]
                (admin7/admin/admin)[color=blue][color=green]
                > > gid:
                > >
                > > (admin7/admin/admin) cmd: php-script alt_doc_root:
                > > /home/virtual/site7/fst/var/
                > >
                > > www chroot: 1
                > >
                > > [2003-07-24 16:10:22]: info: (real/target/actual) uid:[/color][/color]
                (admin7/admin/admin)[color=blue][color=green]
                > > gid:
                > >
                > > (admin7/admin/admin) cmd: php-script alt_doc_root:
                > > /home/virtual/site7/fst/var/
                > >
                > > www chroot: 1
                > >
                > > ----[/SNAP]----
                > >
                > > Any idea?
                > >
                > > Greetings,
                > >
                > > Roger
                > >
                > > "Shawn Wilson" <shawn@glassgia nt.com> schreef in bericht
                > > news:3F1FEE12.A 65AF22F@glassgi ant.com...[color=darkred]
                > > >
                > > >
                > > > Roger Godefroy wrote:
                > > >
                > > > > > > Just a little problem I guess... I have stripped out just an
                > > > >
                > > > > > > imageresize string for ImageMagic in a php-file:
                > > > >
                > > > > > >
                > > > >
                > > > > > > <?
                > > > >
                > > > > > > exec('convert -quality 100 -antialias -sample 100x100
                > > > >
                > > > > > > /var/www/html/aftermath2.jpg[/color][/color][/color]
                /var/www/html/thumb_aftermath .jpg');[color=blue][color=green][color=darkred]
                > > > >
                > > > > > > ?>
                > > > >
                > > > > > >
                > > > >
                > > > > > > The string would work in a shell, but not using the above[/color][/color][/color]
                php-file.[color=blue][color=green][color=darkred]
                > > > >
                > > > > > > Any idea's?
                > > > >
                > > > > >
                > > > >
                > > > > > When you tried it in the shell, did you use the exact same file in[/color][/color][/color]
                the[color=blue][color=green][color=darkred]
                > > > >
                > > > > > exact same directory?
                > > > >
                > > > > Yupz... in the same folder as the php-script and jpg-file using the[/color]
                > > exact[color=darkred]
                > > > > string as in the php-file.
                > > > >
                > > > > > Do you get any error messages (use -debug and -log)? Just some
                > > > >
                > > > > > guesses/suggestions:
                > > > >
                > > > > >
                > > > >
                > > > > > Are you 100% certain the path is correct (did you blindly copy[/color][/color][/color]
                path[color=blue][color=green][color=darkred]
                > > > >
                > > > > > from old server)?
                > > > >
                > > > > Also without the path it would work on the "old" server. On the new[/color]
                > > server,[color=darkred]
                > > > > it wouldn't work with the full path /var/www/html or just the[/color][/color][/color]
                filename.[color=blue][color=green][color=darkred]
                > > > >
                > > > > > Is the original file at least 100x100?
                > > > >
                > > > > Original file is 1600x1200
                > > > >
                > > > > > Try 'convert /var/www/html/aftermath2.jpg
                > > > >
                > > > > > /var/www/html/thumb_aftermath .jpg'. That'll at least confirm it's[/color][/color][/color]
                not[color=blue][color=green][color=darkred]
                > > > >
                > > > > > the sample, quality or antialias.
                > > > >
                > > > > Also no output. However executing in a shell, it would...
                > > > >
                > > > > > Make sure /var/www/html/thumb_aftermath .jpg doesn't exist (could[/color][/color][/color]
                have[color=blue][color=green][color=darkred]
                > > > >
                > > > > > trouble replacing).
                > > > >
                > > > > File not existing...
                > > > >
                > > > > > If you have SSH or Telnet access to the server, try just running[/color][/color][/color]
                the[color=blue][color=green][color=darkred]
                > > > >
                > > > > > command. Try with a different image type. I had a helluva time[/color][/color][/color]
                with[color=blue][color=green][color=darkred]
                > > > >
                > > > > > PNGs - IM was configured wrong.
                > > > >
                > > > > Also when testing with a .gif, no result... :(
                > > >
                > > > Hmmm...
                > > >
                > > > Did you try the log?
                > > >
                > > > Maybe try something simple, like
                > > > passthru("ls -l /var/www/html/");
                > > >
                > > > If you get a list of stuff in that directory, try passthru with your[/color]
                > > convert[color=darkred]
                > > > command...
                > > >
                > > > Maybe this is on the right track:
                > > > From PHP.net (exec function)
                > > > Note that when in 'Safe Mode' you must have the script or program you[/color][/color][/color]
                are[color=blue][color=green][color=darkred]
                > > > trying to execute in the 'safe_mode_exec _dir'. You can find out what[/color][/color][/color]
                this[color=blue][color=green][color=darkred]
                > > > directory is by using phpinfo().[/color][/color]
                >
                > This is a tough one.
                >
                > Maybe try
                > /home/virtual/site7/fst/var/www/html/aftermath2.jpg
                > /home/virtual/site7/fst/var/www/html/thumb_aftermath .jpg
                > as your paths.
                >
                > Or try this and only this in a file (make sure there's no spaces or enters
                > before or after the <?PHP and ?>!!!):
                >
                > <?PHP
                > header("image/jpg");
                > $cmd = "convert xc:#000000 -resize '500x150!' -gravity 'Center' -pointsize[/color]
                '64'[color=blue]
                > -fill '#000099' -draw 'text -4,-16 \"Hello World\"' jpg:-";
                > passthru($cmd);
                > ?>
                >
                > Or it might be header("image/jpeg"); I'm not sure if it matters... You[/color]
                should[color=blue]
                > get a JPG on your browser. If this works, it'll tell you that the problem[/color]
                is[color=blue]
                > likely with your image paths...
                >
                > Shawn
                > --
                > Shawn Wilson
                > shawn@glassgian t.com
                > http://www.glassgiant.com
                >
                >[/color]


                Comment

                • Roger Godefroy

                  #9
                  Re: ImageMagick probz in PHP

                  > > > This is a tough one.[color=blue][color=green][color=darkred]
                  > > >
                  > > > Maybe try
                  > > > /home/virtual/site7/fst/var/www/html/aftermath2.jpg
                  > > > /home/virtual/site7/fst/var/www/html/thumb_aftermath .jpg
                  > > > as your paths.
                  > > >
                  > > > Or try this and only this in a file (make sure there's no spaces or[/color][/color][/color]
                  enters[color=blue][color=green][color=darkred]
                  > > > before or after the <?PHP and ?>!!!):
                  > > >
                  > > > <?PHP
                  > > > header("image/jpg");
                  > > > $cmd = "convert xc:#000000 -resize '500x150!' -gravity[/color][/color][/color]
                  'Center' -pointsize[color=blue][color=green]
                  > > '64'[color=darkred]
                  > > > -fill '#000099' -draw 'text -4,-16 \"Hello World\"' jpg:-";
                  > > > passthru($cmd);
                  > > > ?>
                  > > >
                  > > > Or it might be header("image/jpeg"); I'm not sure if it matters...[/color][/color][/color]
                  You[color=blue][color=green]
                  > > should[color=darkred]
                  > > > get a JPG on your browser. If this works, it'll tell you that the[/color][/color][/color]
                  problem[color=blue][color=green]
                  > > is[color=darkred]
                  > > > likely with your image paths...
                  > > >[/color][/color]
                  >
                  > I'm an idiot. The header line should be:
                  >
                  > header("Content-type: image/jpg");
                  > or
                  > header("Content-type: image/jpeg");
                  >
                  > My apologies...[/color]

                  The headers works fine now, however with a standard not-found-image (red
                  cross) on the screen. So again no result :(


                  Comment

                  • Andy Hassall

                    #10
                    Re: ImageMagick probz in PHP

                    On Thu, 24 Jul 2003 13:59:59 +0200, "Roger Godefroy" <godefroy@(no
                    spam)home.nl> wrote:
                    [color=blue]
                    >Just a little problem I guess... I have stripped out just an imageresize
                    >string for ImageMagic in a php-file:
                    >
                    ><?
                    >exec('conver t -quality 100 -antialias -sample 100x100
                    >/var/www/html/aftermath2.jpg /var/www/html/thumb_aftermath .jpg');
                    >?>[/color]



                    exec has the facility to give you the return code back; use it and post the
                    value, it may give a clue.
                    [color=blue]
                    >The string would work in a shell, but not using the above php-file. Any
                    >idea's?[/color]

                    Your webserver runs in potentially entirely different environment from your
                    shell.

                    Is convert on your webserver's PATH? If not, use a full path to convert (do
                    this anyway).

                    Does the webserver user have permissions to read and write the files?

                    Does the webserver user have permissions to execute convert?

                    --
                    Andy Hassall (andy@andyh.co. uk) icq(5747695) (http://www.andyh.co.uk)
                    Space: disk usage analysis tool (http://www.andyhsoftware.co.uk/space)

                    Comment

                    Working...