HOW TO: convert a gif to a jpg in php?

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

    HOW TO: convert a gif to a jpg in php?

    I have only used the GD lib a little.
    Is there a way to convert a file from a .gif to a .jpeg file?

    Thanks,

    gsb


  • Filth

    #2
    Re: HOW TO: convert a gif to a jpg in php?

    > I have only used the GD lib a little.[color=blue]
    > Is there a way to convert a file from a .gif to a .jpeg file?[/color]

    According to a book I have GD does not support Gif file formats anymore

    but the following might help you depending on the version of GD you have





    Comment

    • Daniel Tryba

      #3
      Re: HOW TO: convert a gif to a jpg in php?

      gsb <gsb@qwest.ne t> wrote:[color=blue]
      > I have only used the GD lib a little.
      > Is there a way to convert a file from a .gif to a .jpeg file?[/color]

      Use http://us3.php.net/manual/en/function.imagejpeg.php with
      http://us3.php.net/manual/en/functio...atefromgif.php as the
      source.

      --

      Daniel Tryba

      Comment

      • Filth

        #4
        Re: HOW TO: convert a gif to a jpg in php?

        > > I have only used the GD lib a little.[color=blue][color=green]
        > > Is there a way to convert a file from a .gif to a .jpeg file?[/color]
        >
        > Use http://us3.php.net/manual/en/function.imagejpeg.php with
        > http://us3.php.net/manual/en/functio...atefromgif.php as the
        > source.[/color]

        might not work because of the following

        Note: Since all GIF support was removed from the GD library in version 1.6,
        this function is not available if you are using that version of the GD
        library.


        Comment

        • Andy Hassall

          #5
          Re: HOW TO: convert a gif to a jpg in php?

          On Thu, 6 May 2004 20:49:14 +0100, "Filth" <p.macdonald@bl ueyonder.co.uk>
          wrote:
          [color=blue][color=green][color=darkred]
          >> > I have only used the GD lib a little.
          >> > Is there a way to convert a file from a .gif to a .jpeg file?[/color]
          >>
          >> Use http://us3.php.net/manual/en/function.imagejpeg.php with
          >> http://us3.php.net/manual/en/functio...atefromgif.php as the
          >> source.[/color]
          >
          >might not work because of the following
          >
          >Note: Since all GIF support was removed from the GD library in version 1.6,
          >this function is not available if you are using that version of the GD
          >library.[/color]

          True, but the version of GD bundled with PHP (equivalent to nearly the latest
          2.0 series of GD plus some extra patches) has had read-only GIF support
          restored a few versions ago - imagecreatefrom gif works, but imagegif won't.

          --
          Andy Hassall <andy@andyh.co. uk> / Space: disk usage analysis tool
          http://www.andyh.co.uk / http://www.andyhsoftware.co.uk/space

          Comment

          • Phil Powell

            #6
            Re: HOW TO: convert a gif to a jpg in php?

            What would you then recommend as an alternative to imagegif() since
            it's READ-ONLY (verifying with PHP 4.3.2 and imagetypes() verifies its
            existence but apparently cannot be used)?

            Thanx
            Phil

            Andy Hassall <andy@andyh.co. uk> wrote in message news:<0p6l909uj s8bdqjtu4r9j6as n8tjqel3rv@4ax. com>...[color=blue]
            > On Thu, 6 May 2004 20:49:14 +0100, "Filth" <p.macdonald@bl ueyonder.co.uk>
            > wrote:
            >[color=green][color=darkred]
            > >> > I have only used the GD lib a little.
            > >> > Is there a way to convert a file from a .gif to a .jpeg file?
            > >>
            > >> Use http://us3.php.net/manual/en/function.imagejpeg.php with
            > >> http://us3.php.net/manual/en/functio...atefromgif.php as the
            > >> source.[/color]
            > >
            > >might not work because of the following
            > >
            > >Note: Since all GIF support was removed from the GD library in version 1.6,
            > >this function is not available if you are using that version of the GD
            > >library.[/color]
            >
            > True, but the version of GD bundled with PHP (equivalent to nearly the latest
            > 2.0 series of GD plus some extra patches) has had read-only GIF support
            > restored a few versions ago - imagecreatefrom gif works, but imagegif won't.[/color]

            Comment

            • Leslie

              #7
              Re: HOW TO: convert a gif to a jpg in php?


              "Phil Powell" <soazine@erols. com> wrote in message
              news:1cdca2a7.0 405100537.58937 026@posting.goo gle.com...[color=blue]
              > What would you then recommend as an alternative to imagegif() since
              > it's READ-ONLY (verifying with PHP 4.3.2 and imagetypes() verifies its
              > existence but apparently cannot be used)?
              >
              > Thanx
              > Phil[/color]

              imagepng()


              Comment

              • Phil Powell

                #8
                Re: HOW TO: convert a gif to a jpg in php?

                "Leslie" <lesliethoare@h otmail.com> wrote in message news:<2ga4fcFf6 ngU1@uni-berlin.de>...[color=blue]
                > "Phil Powell" <soazine@erols. com> wrote in message
                > news:1cdca2a7.0 405100537.58937 026@posting.goo gle.com...[color=green]
                > > What would you then recommend as an alternative to imagegif() since
                > > it's READ-ONLY (verifying with PHP 4.3.2 and imagetypes() verifies its
                > > existence but apparently cannot be used)?
                > >
                > > Thanx
                > > Phil[/color]
                >
                > imagepng()[/color]

                That doesn't work on GIF images, only on PNG. I would have to convert
                them from GIF to PNG.

                Phil

                Comment

                • Leslie

                  #9
                  Re: HOW TO: convert a gif to a jpg in php?

                  > > imagepng()[color=blue]
                  >
                  > That doesn't work on GIF images, only on PNG. I would have to convert
                  > them from GIF to PNG.
                  >
                  > Phil[/color]

                  Why would you? You could use the imagecreatefrom gif() function to read any
                  current gif images you may have, and use imagepng() to write your output as
                  png. Or is there some reason for you to need the output files to be gif? If
                  so, you're out of luck as far as GD is concerned.

                  -Leslie


                  Comment

                  • Phil Powell

                    #10
                    Re: HOW TO: convert a gif to a jpg in php?

                    Which is why I have to convert from GIF to PNG. They want them to be
                    viewable as actual resized images which can only be done if they are
                    not GIF images. Using gif2png works though nicely!

                    Phil

                    "Leslie" <lesliethoare@h otmail.com> wrote in message news:<2gebc1F1t esnU1@uni-berlin.de>...[color=blue][color=green][color=darkred]
                    > > > imagepng()[/color]
                    > >
                    > > That doesn't work on GIF images, only on PNG. I would have to convert
                    > > them from GIF to PNG.
                    > >
                    > > Phil[/color]
                    >
                    > Why would you? You could use the imagecreatefrom gif() function to read any
                    > current gif images you may have, and use imagepng() to write your output as
                    > png. Or is there some reason for you to need the output files to be gif? If
                    > so, you're out of luck as far as GD is concerned.
                    >
                    > -Leslie[/color]

                    Comment

                    Working...