Jump to content

please really need help......

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
4 replies to this topic

#1
saif0909

saif0909

    Newbie

  • Members
  • Pip
  • 6 posts
hi to all i really need help with some img upload errors
please help me.......

the errors are:

Warning: imagecreatefromjpeg(/artist_gallery/Hrido Khan.jpg) [function.imagecreatefromjpeg]: failed to open stream: No such file or directory in /home/username/public_html/mysite.com/music/admin/audioadmin.php on line 2757

Warning: imagesx(): supplied argument is not a valid Image resource in /home/username/public_html/mysite.com/music/admin/audioadmin.php on line 2758

Warning: imagesy(): supplied argument is not a valid Image resource in /home/username/public_html/mysite.com/music/admin/audioadmin.php on line 2759

Warning: imagecopyresized(): supplied argument is not a valid Image resource in /home/username/public_html/mysite.com/music/admin/audioadmin.php on line 2763

Warning: imagejpeg() [function.imagejpeg]: Unable to open '/artist_gallery/small-Hrido Khan.jpg' for writing: No such file or directory in /home/username/public_html/mysite.com/music/admin/audioadmin.php on line 2764

Line#2757, #2764 i was try lot to fix it i thing my directory path its right...but i don't no....
and other 2 error samething can't fixed...please help me




Error #2757
$img=ImageCreateFromJPEG($filename);

Error #2758
	$dstW=imagesx($img);

Error #2759
	$dstH=imagesy($img);

Error #2763
imagecopyresized($rimg, $img, 0, 0, 0, 0, $srcW, $srcH, $dstW, $dstH);

Error #2764
imagejpeg($rimg, $smallpath);


here is the codes


// Save Information?

		if( $HTTP_GET_VARS['save'] == 'yes' ) {

			

			$str_upload = trim(basename($HTTP_POST_FILES["userfile"]["name"]));

	       $UPLOAD_PATH = "/artist_gallery/";

		   if(@is_uploaded_file($HTTP_POST_FILES["userfile"]["tmp_name"])) {

		   	  move_uploaded_file($HTTP_POST_FILES["userfile"]["tmp_name"],ROOT_DIR.$UPLOAD_PATH.$str_upload);

	          $aid=$HTTP_POST_VARS['aid'];

	          //mysql_query("INSERT INTO avaiting_artist(id_artist,url,username) VALUES('$aid', 'artist_gallery/avaiting/$str_upload','{$_SESSION[username]}')");

	          //******************************

	          $filename=$UPLOAD_PATH.$str_upload;

	          $smallpath=substr($filename, 0, strpos($filename, strrchr($filename, "/")));

	          $twopart=substr($filename, strpos($filename, strrchr($filename, "/"))+1, strlen($filename));

	          $smallpath=$smallpath."/small-".$twopart;

	          $it=substr($filename, strlen($filename)-3, strlen($filename));

	          if ($it=="jpg") {

	            $img=ImageCreateFromJPEG($filename);

	             $dstW=imagesx($img);

	             $dstH=imagesy($img);

	             $srcW=100;

	             $srcH=100;

	             $rimg=imagecreatetruecolor($srcW, $srcH);

	             imagecopyresized($rimg, $img, 0, 0, 0, 0, $srcW, $srcH, $dstW, $dstH);

	             imagejpeg($rimg, $smallpath);

	          }

	         if ($it=="gif") {

	            $img=ImageCreateFromGIF($filename);

	            $dstW=imagesx($img);

	            $dstH=imagesy($img);

	            $srcW=100;

	            $srcH=100;

	            $rimg=imagecreatetruecolor($srcW, $srcH);

	            imagecopyresized($rimg, $img, 0, 0, 0, 0, $srcW, $srcH, $dstW, $dstH);

	            imagegif($rimg, $smallpath);

	         }

	          //******************************

		   }


#2
Feral

Feral

    Programmer

  • Members
  • PipPipPipPip
  • 162 posts
1.) check to make sure that move_uploaded_file is actually moving the file.
2.) if move_uploaded_file returns true then trying adding ROOT_DIR to $filename OR simply use file_exists to check if the file is there before tying to use it.

#3
saif0909

saif0909

    Newbie

  • Members
  • Pip
  • 6 posts
hey...i think its work...but no error come just say Warning: We were unable to create a new Album.
can u tell me why please?........

#4
Feral

Feral

    Programmer

  • Members
  • PipPipPipPip
  • 162 posts
You would need to post the part of the code that contains that error message.

#5
saif0909

saif0909

    Newbie

  • Members
  • Pip
  • 6 posts
hello sir, i was try to post cods but its give me error message unable to post when i try to post
because i have to mush link in there...
so please give a way to post that codes.........