How do i resize the following like to 100x100 using html or anything?
http://graph.facebook.com/4/picture?type=large
http://graph.facebook.com/4/picture?type=large
I am making a plugin to display people's facebook picture on MyBB
Thanks
/**
* Parses IMG MyCode.
*
* @param string The URL to the image
* @param array Optional array of dimensions
*/
function mycode_parse_img($url, $dimensions=array(), $align='')
{
global $lang;
$url = trim($url);
$url = str_replace("\n", "", $url);
$url = str_replace("\r", "", $url);
if($align == "right")
{
$css_align = " style=\"float: right;\"";
}
else if($align == "left")
{
$css_align = " style=\"float: left;\"";
}
$alt = htmlspecialchars_uni(basename($url));
if(my_strlen($alt) > 55)
{
$alt = my_substr($alt, 0, 40)."...".my_substr($alt, -10);
}
$alt = $lang->sprintf($lang->posted_image, $alt);
if($dimensions[0] > 0 && $dimensions[1] > 0)
{
return "<img src=\"{$url}\" width=\"{$dimensions[0]}\" height=\"{$dimensions[1]}\" border=\"0\" alt=\"{$alt}\"{$css_align} />";
}
else
{
return "<img src=\"{$url}\" border=\"0\" alt=\"{$alt}\"{$css_align} />";
}
}
The stuff after if($dimensions[0] > 0 && $dimensions[1] > 0) should help, I think, since it does deal with resizing
@Alex597:
Thanks a lot mate. i got it to work.
i separated the codes into 2 lines. I can now resize them.
$fbavaurl = 'http://graph.facebook.com/'.$post['fid4'].'/picture?type=large';
$post['useravatar']= '<img src= '.$fbavaurl.' width="80px" height="80px">';