Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 05-06-2009, 03:33 AM   PM User | #1
Papajo
New Coder

 
Join Date: Oct 2008
Posts: 28
Thanks: 4
Thanked 0 Times in 0 Posts
Papajo is an unknown quantity at this point
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); 
Papajo is offline   Reply With Quote
Old 05-06-2009, 03:46 AM   PM User | #2
bdl
Regular Coder

 
Join Date: Apr 2007
Location: Camarillo, CA US
Posts: 590
Thanks: 4
Thanked 83 Times in 82 Posts
bdl is an unknown quantity at this point
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
bdl is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 06:07 PM.


Advertisement
Log in to turn off these ads.