All pastes #78001 Raw Edit

CLucas916

public php v1 · immutable
·published 2006-07-03 18:00 UTC
rendered paste body
<?php$target_path = "gallery/tmp/";$target_path = $target_path . basename( $_FILES['uploadedfile']['name']); if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)) {    echo "The file ".  basename( $_FILES['uploadedfile']['name']).     " has been uploaded";} else{    echo "There was an error uploading the file, please try again!";}//$gallery = $_POST['gallery'];$gallery = 'Balls';$new_w = '400';$new_h = '400';$pics_folder = 'gallery/gal/'.$gallery.'/';$search = 'gallery/tmp/*.jpg'; //{*.jpg,*.JPG,*.png,*.PNG,*.jpeg,*.JPEG}';$list = glob($search);foreach ($list as $pp) {	//Thumbnail Creation	$file = explode("/", $pp);	$p = $file[2];	print $p;	$new_w = '250';	$new_h = '250';	$size = GetImageSize($p);	$old_x = $size[0];	$old_y = $size[1];	if ($old_x > $old_y) {		$thumb_w=$new_w;		$thumb_h=$old_y*($new_h/$old_x);	}	if ($old_x < $old_y) {		$thumb_w=$old_x*($new_w/$old_y);		$thumb_h=$new_h;	}	if ($old_x == $old_y) {		$thumb_w=$new_w;		$thumb_h=$new_h;	}	echo 'Thumb Created Successfully!';	$dst_img = ImageCreateTrueColor($thumb_w,$thumb_h);	$image = ImageCreateFromJPEG($p);	imagecopyresampled($dst_img,$image,0,0,0,0,$thumb_w,$thumb_h,$old_x,$old_y);	imagejpeg($dst_img, $pics_folder.'_thb_'.$p, 100);	//Full-Size Image Creation	$new_w = '550';	$new_h = '550';	if ($old_x > $old_y) {		$full_w=$new_w;		$full_h=$old_y*($new_h/$old_x);	}	if ($old_x < $old_y) {		$full_w=$old_x*($new_w/$old_y);		$full_h=$new_h;	}	if ($old_x == $old_y) {		$full_w=$new_w;		$full_w=$new_h;	}	$dst_img = ImageCreateTrueColor($full_w,$full_h);	$image = ImageCreateFromJPEG($p);	imagecopyresampled($dst_img,$image,0,0,0,0,$full_w,$full_w,$old_x,$old_y);	imagejpeg($dst_img, $pics_folder.$p, 100);}?>