Jump to content

getimagesize() - No such file or directory


neridaj

Recommended Posts

I don't understand why I keep getting this no file or directory error when this function is run. function should loop through an array of images and output the width and height but for some reason all I get is warnings about the directory or file being non existent - which from the error output clearly shows the files being scanned by getimagesize().

 

Here is the error output: "Warning: getimagesize(01.jpg) [function.getimagesize]: failed to open stream: No such file or directory"

 

function get_imgdir()
{
$propadd = $_GET['pa'];
$userfolder = $_SESSION['valid_user'];
$imgdir = 'members/' . $userfolder . '/' . $propadd . '/';
return $imgdir;
}

function get_imgdim()
{
$dir = get_imgdir();
$files = scandir($dir);
foreach($files as $value) {
	// check for image files
	if(valid_image_file($value)) {
		// build image array
		$imgarr[] = $value;
		$count = count($files);
		for($i = 0; $i < $count; $i++) {
			 list($width, $height) = getimagesize($imgarr[$i]);
			 $dimarr[$imgarr[$i]] = array("width" => $width, "height" => $height);
		}
		print_r($dimarr);
	}
}
}

 

Is there a better way to go about getting the dimensions of the image?

 

Thanks,

 

Jason

Link to comment
https://forums.phpfreaks.com/topic/100216-getimagesize-no-such-file-or-directory/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.