getimagesize() with remote urls? [RESOLVED: get phpv2]
So over the last 3 days I've been writing an imageboard for my website (http://ethraax.exofire.net/). It's almost done but I've run into a problem I can't seem to fix.
The old way I resized images was making all images in the thread list as 64x64, and all images in the thread itself as 512x512.
The images are all (almost all) remote URLs, from sites like imageshack and photobucket.
Anyway, today I wrote some code to find the height and width that the image should be to fit in that square, without changing the proportions of the image (ie skewing rectangular images).
The code looks like this:
When called, however, it throws out an error saying that remote url linking is not allowed in the configuration.
I *could* force people to upload all images to my site, but that'd take up space and bandwidth (not to mention code) on my side that doesn't need to be there. Also it introduces a couple security issues not present in the remote way to do it.
Anyone know of a workaround, or know if I need to upgrade my PHP version here to be able to do this?
EDIT: Here's the exact error:
So over the last 3 days I've been writing an imageboard for my website (http://ethraax.exofire.net/). It's almost done but I've run into a problem I can't seem to fix.
The old way I resized images was making all images in the thread list as 64x64, and all images in the thread itself as 512x512.
The images are all (almost all) remote URLs, from sites like imageshack and photobucket.
Anyway, today I wrote some code to find the height and width that the image should be to fit in that square, without changing the proportions of the image (ie skewing rectangular images).
The code looks like this:
PHP:
function ib_getProperSize($imgurl, $maxsize)
{
// This function will return a string that looks like:
// "height=\"256\" width=\"435\"
$isize = getimagesize($imgurl);
$ix = $isize[0];
$iy = $isize[1];
if ($ix > $iy)
{
// horizontal, scale x to max.
$nx = $maxsize;
$ny = round($nx * $iy / $ix);
}
else {
$ny = $maxsize;
$nx = round($ny * $ix / $iy);
}
$str = "height=\"$ny\" width=\"$nx\"";
return $str;
}
When called, however, it throws out an error saying that remote url linking is not allowed in the configuration.
I *could* force people to upload all images to my site, but that'd take up space and bandwidth (not to mention code) on my side that doesn't need to be there. Also it introduces a couple security issues not present in the remote way to do it.
Anyone know of a workaround, or know if I need to upgrade my PHP version here to be able to do this?
EDIT: Here's the exact error:
Code:
Warning: getimagesize() [function.getimagesize]: URL file-access is disabled in the server configuration in...
Last edited: