All pastes #808719 Raw Edit

Unnamed

public text v1 · immutable
·published 2007-12-07 21:16 UTC
rendered paste body
if($_POST['submit_submit'] == TRUE){
function create_thumb($name, $filename, $new_w, $new_h)
{
	$src_img = @imagecreatefromjpeg($name) or die("Error!");
	$old_x = imagesx($src_img);
	$old_y = imagesy($src_img);
	$thumb_w = $new_w;
	$thumb_h = $new_h;
	$dst_img = imagecreatetruecolor($thumb_w, $thumb_h);
	imagecopyresampled($dst_img, $src_img, 0, 0, 0, 0, $thumb_w, $thumb_h, $old_x, $old_y);
	imagejpeg($dst_img, $filename, 90);
	imagedestroy($dst_img);
	imagedestroy($src_img);
}

create_thumb($_FILES['submit_thumb']['tmp_name'], "thumbs/" . $time . ".jpg", 160, 120);
}

<input name="submit_thumb" type="file" id="submit_thumb"> <input name="submit_submit" type="submit" id="submit_submit" value="Submit">