New Image File

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

    #1

    New Image File

    Consider the following code:

    <?php

    $image = imagecreatefrom jpeg($_FILES['imagefile']['tmp_name']);
    $newimage = imagecopyresamp led($image_p, $image, 0, 0, 0, 0, 200,
    $height*$ratio, $width, $height);

    ?>

    How do I save $newimage as "images/image.jpg"?

  • ZeldorBlat

    #2
    Re: New Image File

    >Consider the following code:[color=blue]
    >
    ><?php
    >
    >$image = imagecreatefrom jpeg($_FILES['imagefile']['tmp_name']);
    >$newimage = imagecopyresamp led($image_p, $image, 0, 0, 0, 0, 200,
    >$height*$ratio , $width, $height);
    >
    >?>
    >
    >How do I save $newimage as "images/image.jpg"?[/color]

    imagejpeg($newi mage, 'images/image.jpg');

    Comment

    • Trevor

      #3
      Re: New Image File

      Thank you very much, that worked splendidly. Now I have one more
      question. I'm performing a similar task with a GIF file, but PHP tells
      me imagegif() doesn't exist. Why would that be? I'm running PHP 4.3.2.

      Comment

      • Roman Khutkyy

        #4
        Re: New Image File

        On Fri, 28 Oct 2005 05:33:20 +0300, Trevor <trevordixon@gm ail.com> wrote:
        [color=blue]
        > Thank you very much, that worked splendidly. Now I have one more
        > question. I'm performing a similar task with a GIF file, but PHP tells
        > me imagegif() doesn't exist. Why would that be? I'm running PHP 4.3.2.
        >[/color]

        Looks like yuo're saying about Win32 version of GD...
        If so - it really doesnt work. But on .nix platforms it does (sure if the
        newest GD module installed)


        --
        Exact Meta Search

        Comment

        • Steve

          #5
          Re: New Image File

          [color=blue]
          > question. I'm performing a similar task with a GIF file, but PHP tells
          > me imagegif() doesn't exist. Why would that be? I'm running PHP 4.3.2.[/color]

          First check the output from phpinfo(); to see what is compiled
          in/available. What you do next depends on your OS. See
          <http://www.php.net/manual/en/ref.image.php> for details.

          ---
          Steve

          Comment

          • Ewoud Dronkert

            #6
            Re: New Image File

            Trevor wrote:[color=blue]
            > PHP tells me imagegif() doesn't exist.[/color]

            Use imagepng() instead.

            --
            E. Dronkert

            Comment

            • Trevor

              #7
              Re: New Image File

              I'm running Red Hat. phpinfo() tells me this:

              GD Support enabled
              GD Version bundled (2.0.12 compatible)
              FreeType Support enabled
              FreeType Linkage with freetype
              GIF Read Support enabled
              JPG Support enabled
              PNG Support enabled
              WBMP Support enabled
              XBM Support enabled

              Comment

              • Steve

                #8
                Re: New Image File

                [color=blue]
                > GD Support enabled
                > GD Version bundled (2.0.12 compatible)[/color]
                [color=blue]
                >From the reference quoted above:[/color]

                "The format of images you are able to manipulate depend on the version
                of GD you install, and any other libraries GD might need to access
                those image formats. Versions of GD older than gd-1.6 support GIF
                format images, and do not support PNG, where versions greater than
                gd-1.6 and less than gd-2.0.28 support PNG, not GIF. GIF support was
                re-enabled in gd-2.0.28."

                You need to upgrade your GD.

                ---
                Steve

                Comment

                Working...