Jump to content


Photo

Thumbnail generation problem


  • Please log in to reply
5 replies to this topic

#1 insrtsnhere13

insrtsnhere13
  • Members
  • PipPipPip
  • Advanced Member
  • 64 posts

Posted 05 March 2006 - 06:25 PM

This is the code im am using
<form enctype="multipart/form-data" action="<?=$_SERVER['PHP_SELF']?>" method="POST"> 
<input type="hidden" name="MAX_FILE_SIZE" value="3000000"> 
Image:<br><input name="userfile" type="file"><br>
<input type="submit" name="upload" value="Upload">

<?
$uploaddir = '/usr/home/pwncae/public_html/gallery/';
$uploadfile = $uploaddir . basename($_FILES['userfile']['name']); 

if(isset($_POST['upload']))
{ 
if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) { 
   echo "<br>File is valid, and was successfully uploaded.";
$fullurl='http://www.pwncaeks.com/gallery/'.$_FILES['userfile']['name'];

$im_file_name = $fullurl;
$image_attribs = getimagesize($im_file_name);
$im_old = imageCreateFromJpeg($im_file_name);
$th_max_width = 144;
$th_max_height = 144;
$ratio = ($width > $height) ? $th_max_width/$image_attribs[0] : $th_max_height/$image_attribs[1];
$th_width = $image_attribs[0] * $ratio;
$th_height = $image_attribs[1] * $ratio;
$im_new = imagecreatetruecolor($th_width,$th_height);
imageAntiAlias($im_new,true);
$th_file_name = '/gallery/thumbs/' . $_FILES['image_file']['name'];
imageCopyResampled($im_new,$im_old,0,0,0,0,$th_width,$th_height, $image_attribs[0], $image_attribs[1]);
imageJpeg($im_new,$im_file_name,100); }}
?>

See below for the error

#2 insrtsnhere13

insrtsnhere13
  • Members
  • PipPipPip
  • Advanced Member
  • 64 posts

Posted 06 March 2006 - 01:29 PM

File is valid, and was successfully uploaded.
Warning: imagejpeg(): Unable to open 'http://www.pwncaeks....gallery/thumbs/' for writing in /home/pwncae/public_html/dashboard/testgall2.php on line 34

sorry about the first post, the errors there arent what was actually going on, used to much bandwidth at once so it cut the image off, anyway, the above error is my problem

#3 insrtsnhere13

insrtsnhere13
  • Members
  • PipPipPip
  • Advanced Member
  • 64 posts

Posted 07 March 2006 - 05:09 AM

seriously, can someone please help me with this, i have no clue whats wrong..

#4 insrtsnhere13

insrtsnhere13
  • Members
  • PipPipPip
  • Advanced Member
  • 64 posts

Posted 07 March 2006 - 02:01 PM

omfg.. someone please help me.. im desperate!

#5 AndyB

AndyB
  • Staff Alumni
  • Advanced Member
  • 5,465 posts
  • LocationToronto

Posted 07 March 2006 - 02:28 PM

Does the folder ..../gallery/thumbs actually exist? Does it have the correct permissions to allow you to save files to it?
Legend has it that reading the manual never killed anyone.
My site

#6 insrtsnhere13

insrtsnhere13
  • Members
  • PipPipPip
  • Advanced Member
  • 64 posts

Posted 07 March 2006 - 06:20 PM

yes, there is a thumbs folder in the gallery folder and both are chmod to 0777




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users