Wrox Home  
Search P2P Archive for: Go

  Return to Index  

pro_php thread: getting image width using php


Message #1 by "Wojciech Pirog" <moharo@h...> on Tue, 18 Mar 2003 12:41:06
As already written u can user getimagesize() 
This function will return an array.
array[3] is a string containing height and width ( well I think that an
string is pretty sucky for height and width ).
Here's a small function I wrote, returning an associative array containing
the width and height value

/*
array[] function getSize($file)
returns image height and width in an associative array
$file = path to image file
*/
function getSize($file)
{
	$values			  = getimagesize($file);
	$temp_width 	= strpos($values[3],'"',7);
	$temp_height = strpos($values[3],'"',$temp_width+1)+1;
	$size["width"]	  = substr($values[3],7,$temp_width-7);
	$size["height"]	  
substr($values[3],$temp_height,strpos($values[3],'"',$temp_height+1)-$temp_height);
	return $size;
}


GreetZ,
Cit

> hey
> 
> is there a function that can get the image's width and height?
> 

-- 
+++ GMX - Mail, Messaging & more  http://www.gmx.net +++
Bitte lächeln! Fotogalerie online mit GMX ohne eigene Homepage!


  Return to Index