Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
cannot get image size for images having space in their name
Old 02-10-2009, 04:46 AM cannot get image size for images having space in their name
Novice Talker

Posts: 10
Trades: 0
I am using following fucntion to get proportionate width for user specific height

However I noticed that in case image name is having space it gives an error
Example Function works ok for image name say "pict1.jpg"

However gives error for
pict 1.jpg (space in name beforer 1)

list($width, $height, $type, $attr) = getimagesize(addslashes($imagename));
if ($width ==0)
{$imgstr="No Image"; }
else
{
$h=$height*($reqwidth/$width) ;
if ($width > $reqwidth)
{ $imgstr="<img src='".addslashes($imagename)."' width=".$reqwidth." height=".$h." border=0 >";}
else
{ $imgstr="<img src='".addslashes($imagename)."' width=".$width." height=".$height." border=0 >";}
}
return $imgstr;
}
vikaspa is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 02-10-2009, 01:43 PM Re: cannot get image size for images having space in their name
rogem002's Avatar
PHP Chap

Posts: 843
Name: Mike
Location: United Kingdom
Trades: 0
The space in the name is most likely making the file inaccessible. Is the problem with actually getting the file or when php returns the $imgstr ?

Either way, try adding a rawurlencode() in there http://uk2.php.net/manual/en/function.rawurlencode.php
__________________
My Blog/Site:
Please login or register to view this content. Registration is FREE
rogem002 is offline
Reply With Quote
View Public Profile Visit rogem002's homepage!
 
Old 02-11-2009, 06:35 AM Re: cannot get image size for images having space in their name
mtishetsky's Avatar
King Spam Talker

Posts: 1,226
Name: Mike
Location: Mataro, Spain
Trades: 0
Did u try getimagesize($imagename) without addslashes()?
__________________

Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE

And don't forget to give me talkupation!
mtishetsky is offline
Reply With Quote
View Public Profile Visit mtishetsky's homepage!
 
Reply     « Reply to cannot get image size for images having space in their name
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.17942 seconds with 12 queries