how i can do it? but i want it number with out any exrta and i tried getimagesize but its not get me the number only
+7
A:
Try like this:
list($width, $height) = getimagesize('path_to_image');
Make sure that:
1. You specify the correct image path there
2. The image has read access
3. Chmod image dir to 755
Also try to prefix path with $_SERVER[DOCUMENT_ROOT], this helps sometimes when you are not able to read the files
Sarfraz
2010-02-01 18:39:27
thank you very much
moustafa
2010-02-01 18:42:45
2 fast 2 furious :) great details, i'm feeling lame ^^
Julien
2010-02-01 18:45:26
@moustafa: you are welcome :)
Sarfraz
2010-02-01 18:48:34
777 on directory is not needed.
poke
2010-02-01 18:57:21
@poke: are you really 100% sure?
Sarfraz
2010-02-18 05:04:15
Yes. 777 means read, write and execute right for owner, group, and all. You need read and execute right to access a directory, but you don't need write right; and you also don't need that right for everybody. 755 should be fine for every access where you don't need to create files inside of the directory.
poke
2010-02-18 18:51:50
poke: thanks and fixed :)
Sarfraz
2010-02-18 19:03:32
+1
A:
list($width, $height) = getimagesize($filename)
Or,
$data = getimagesize($filename);
$width = $data[0];
$height = $data[1];
davethegr8
2010-02-01 18:40:04
+1
A:
getimagesize() returns an array containing the image properties.
list($width, $height) = getinagesize("path/to/image.jpg");
to just get the width and height or
list($width, $height, $type, $attr)
to get some more info.
Matt
2010-02-01 18:40:44
+1
A:
PHP's getimagesize() returns an array of data. The first two items in the array are the two items you're interested in: the width and height. To get these, you would simply request the first two indexes in the returned array:
var $imagedata = getimagesize("someimage.jpg");
print "Image width is: " . $imagedata[0];
print "Image height is: " . $imagedata[1];
For further information, see the documentation.
Jonathan Sampson
2010-02-01 18:42:51
+1
A:
Like this :
imageCreateFromPNG($var);
//I don't know where from you get your image, here it's in the png case
// and then :
list($width, $height) = getimagesize($image);
echo $width;
echo $height;
Julien
2010-02-01 18:42:55