resize an image and upload it to server

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • rinkudhimar
    New Member
    • Jun 2007
    • 13

    resize an image and upload it to server

    resize an image and upload it to server
  • mwasif
    Recognized Expert Contributor
    • Jul 2006
    • 802

    #2
    Upload the image to server and resize it.

    Comment

    • pbmods
      Recognized Expert Expert
      • Apr 2007
      • 5821

      #3
      Heya, rinkudhimar.

      Sure.

      For $100.

      Seriously now. You're going to have to give us more info than that.

      Have you at least TRIED to implement it?

      Comment

      • rinkudhimar
        New Member
        • Jun 2007
        • 13

        #4
        yes
        the code is

        [code=php]

        <?php
        $userfile_name= "image/terrest_gif.gif ";
        $add="e:/$userfile_name" ; // the path with the file name where the file will be stored, upload is the directory name.
        if(copy($userfi le_name, $add)){
        echo "Successful ly uploaded the image";
        chmod("$add",77 7);
        }else
        {
        echo "Failed to upload file Contact Site admin to fix the problem";
        exit;}
        $n_width=100; // Fix the width of the thumb nail images
        $n_height=100; // Fix the height of the thumb nail imaage
        $tsrc="c:/$userfile_name" ; // Path where thumb nail image will be stored

        if (!($userfile_ty pe =="image/pjpeg" OR $userfile_type= ="image/terrest_gif.gif "))
        {
        echo "Your uploaded file must be of JPG or GIF. Other file types are not allowed<BR>";
        exit;
        }

        if (@$userfile_typ e=="image/terrest_gif.gif "){
        $im=ImageCreate FromGIF($add);
        echo "$im";
        $width=ImageSx( $im);
        echo "$width"; // Original picture width is stored
        $height=ImageSy ($im);
        echo $height; // Original picture height is stored
        $newimage=image createtruecolor ($n_width,$n_he ight);
        imageCopyResize d($newimage,$im ,0,0,0,0,$n_wid th,$n_height,$w idth,$height);

        if (function_exist s("imagegif") ) {
        Header("Content-type: image/gif");
        ImageGIF($newim age,$tsrc);
        }
        elseif (function_exist s("imagejpeg" )) {
        Header("Content-type: image/jpeg");
        ImageJPEG($newi mage,$tsrc);
        }

        chmod("$tsrc",7 77);
        if($userfile_ty pe=="image/pjpeg"){
        $im=ImageCreate FromJPEG($add);
        $width=ImageSx( $im); // Original picture width is stored
        $height=ImageSy ($im); // Original picture height is stored
        $newimage=image createtruecolor ($n_width,$n_he ight);
        imageCopyResize d($newimage,$im ,0,0,0,0,$n_wid th,$n_height,$w idth,$height);
        ImageJpeg($newi mage,$tsrc);
        chmod("$tsrc",7 77);
        }
        }
        ?>
        [/code]
        Originally posted by pbmods
        Heya, rinkudhimar.

        Sure.

        For $100.

        Seriously now. You're going to have to give us more info than that.

        Have you at least TRIED to implement it?
        Originally posted by Ajaxrand
        Format for the code tag is [CODE=language] [ / CODE]. not <code>. Full list of Code Tag Supported Languages

        Comment

        • developing
          New Member
          • Mar 2007
          • 110

          #5
          this forums awsome!! all i needed was a function to get image dimensions...go t a lot more than that....good work people

          Comment

          • rinkudhimar
            New Member
            • Jun 2007
            • 13

            #6
            I am also expecting answers to my question and not such funny comments daily. I have sent the full code just because you get a detailed idea. Anyways I think that you cannot help at all.

            Comment

            • code green
              Recognized Expert Top Contributor
              • Mar 2007
              • 1726

              #7
              OK. Now we can see some code (difficult to read without tags!!) what is the problem?

              Comment

              • ak1dnar
                Recognized Expert Top Contributor
                • Jan 2007
                • 1584

                #8
                Originally posted by code green
                (difficult to read without tags!!)
                Now It's ready to go.

                Comment

                Working...