Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Oct 2008
    Posts
    28
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Submit url to script

    Hi
    I need to know how to setup a form so I can submit an image url to this script. I know I'm missing something here. Thank Joe

    <center><form name='src' action='' method='post'>
    input type='text' size='45' name='url' />
    <input type='submit' name='submit' value='Process It'>
    <input type='reset' value='Clear'>
    </form></center>

    PHP Code:
    // The file
    $filename 'image/somefile.jpeg';
    $percent 0.5;

    // Content type
    header('Content-type: image/jpeg');

    // Get new dimensions
    list($width$height) = getimagesize($filename);
    $new_width $width $percent;
    $new_height $height $percent;

    // Resample
    $image_p imagecreatetruecolor($new_width$new_height);
    $image imagecreatefromjpeg($filename);
    imagecopyresampled($image_p$image0000$new_width$new_height$width$height);

    // Output
    imagejpeg($image_pnull100); 

  • #2
    bdl
    bdl is offline
    Regular Coder
    Join Date
    Apr 2007
    Location
    Camarillo, CA US
    Posts
    590
    Thanks
    4
    Thanked 83 Times in 82 Posts
    You're missing quite alot from the looks of it.

    1) A FORM element 'action' attribute is missing a value, ie. the recieving script.
    2) Your script doesn't handle any POST data
    3) Your script will have to carefully validate the incoming request, eg. against a list of known images would be ideal.

    PHP Manual:
    Language Reference
    Predefined Variables


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •