getimagesize() with remote urls?

ethraax

New Member
Messages
56
Reaction score
0
Points
0
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:

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:

ethraax

New Member
Messages
56
Reaction score
0
Points
0
Doesn't work, it won't allow fopen on a remote url either. Thanks for the try though...
 

Slothie

New Member
Messages
1,429
Reaction score
0
Points
0
Get phpv2. Then curl it , get the size and then delete it.
 

ethraax

New Member
Messages
56
Reaction score
0
Points
0
So here's another one... I can't access my account through x10hosting.com (although I can log onto cpanel, my mail, etc).

:eek:.

Anyway, is there a forum to post in? I was under the impression that the only way was through some acct thing there but...
 
Last edited:

ethraax

New Member
Messages
56
Reaction score
0
Points
0
No my site loads fine, as does cPanel and even my mail. THe account panel at x10hosting.com/account does not load.

"An Error Has Occurred
Whoops, an error occurred retrieving your account's data from our system. Please try your request again in a few moments."

Hasn't loaded for well over a week, never bothered to do anything about it since I didn't need to ^^.
 
Top