Well, I am currently trying to modify my current BBCode tags, but I want to make the IMG tags to resize all pictures that are bigger than **** by **** pixels. However, I cannot figure out how to find the size of a picture from an external link. I can check pictures that are uploaded, but do not know how to check external ones. There must be a way, but HOW?!?
I have Googled and asked just about everywhere and no answer. So do you guys know how?
How to get Picture Sizes?
Try this search
http://www.google.com/search?client=ope ... 8&oe=utf-8
http://www.google.com/search?client=ope ... 8&oe=utf-8
That was the first thing that I tried, lol. But the problem with those is that it makes you upload. But I don't want to have the image uploaded.thetarget wrote:Try this search
http://www.google.com/search?client=ope ... 8&oe=utf-8
function, that you just mentioned can be used for images, that are uploaded to server or for images, that can be reached via URL ( http://www.domain.com/images/picture.gif [need special server configuration] ) You can not use this function to get the size of images, that is on user computers. even javascript will not help you because of javascript's security restrtictions
[php]list($img_width, $img_height) = getimagesize("img/flag.jpg");[/php]and you will have variables $img_width, $img_height that you need.Flipper3 wrote:Dimensions and size, but dimensions are more important and what I really want.
To get a size by bytes use function filesize. Example:
[php]$img_size = filesize("img/flag.jpg");[/php] and you will have variable $img_size with images size by bytes. To convert bytes to normal look, you can use this function:
[php] function get_size($size)
{
$bytes = array('B','KB','MB','GB','TB');
foreach($bytes as $val) {
if($size > 1024){
$size = $size / 1024;
}else{
break;
}
}
return round($size, 2)." ".$val;
}[/php]if you need any more help regarding this topic, do not hesitate to ask