homepage Welcome to WebmasterWorld Guest from 54.227.12.4
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

    
Problem with PHP, 'GetImageSize' function
GetImageSize("photos/",$name,".jpg") gives 'Wrong parameter count ...'
Soupisgoodfood




msg:1286135
 11:03 pm on Jul 13, 2001 (gmt 0)

I'm using this code:

--
<?php list($width, $height) = GetImageSize("photos/",$name,".jpg"); ?> <----[line 3]

<img src="photos/<?php echo $name; ?>.jpg" width="<?php echo $width; ?>" height="<?php echo $height; ?>" id="photo">
--

And getting this error:

--
Warning: Wrong parameter count for getimagesize() in c:\-= web-sites =-\in progress\photography\site\photo.php on line 3
--

If I change the ("photos/",$name,".jpg") part to ("photos/THEFILENAME.jpg"), it works fine. Is there something else I should be using instead of commers to seperate the parts? Or does it need to be done another way?

Thanks,
Justin.

 

sugarkane




msg:1286136
 7:11 am on Jul 14, 2001 (gmt 0)

Try this:

$foo = GetImageSize("photos$name.jpg");
$width=$foo[0];
$height=$foo[1];

There's no need to split up the path, filename and extension with commas - PHP can interprate a variable within a string just fine.

Does that work?

David




msg:1286137
 2:06 pm on Jul 14, 2001 (gmt 0)

You can do this also
$photo="photo/filename.jpg";
getimagesize($photo,information);
// information is the aray of your data

$information[0] is the width
$information[1] is the height
$information[2] is the Image type GIF=1,JPG=2,PNG=3
$information[3] is height=150 width=200 - for IMG tags

Soupisgoodfood




msg:1286138
 11:04 pm on Jul 14, 2001 (gmt 0)

Thanks, guys. I managed to find a solution at php.net (spose that's where I should have looked in the first place). And replaced the commers with fullstops, so it counts as one string. There seems to be about 20 ways to string a thing :)

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved