Jump to content

Thumbnail generation problem


insrtsnhere13

Recommended Posts

This is the code im am using
[code]
<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); }}
?>[/code]

See below for the error
Link to comment
Share on other sites

File is valid, and was successfully uploaded.
Warning: imagejpeg(): Unable to open 'http://www.pwncaeks.com/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
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.