+ Reply to Thread
Results 1 to 7 of 7

Thread: getimagesize() with remote urls?

  1. #1
    ethraax is offline x10Hosting Member ethraax is an unknown quantity at this point
    Join Date
    Oct 2007
    Posts
    56

    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 Code:
    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 by ethraax; 10-28-2007 at 08:17 PM.

  2. #2
    Thewinator is offline x10 Lieutenant Thewinator is an unknown quantity at this point
    Join Date
    Oct 2007
    Location
    [NL]
    Posts
    256

    Re: getimagesize() with remote urls?

    I found this on php.net:
    http://nl2.php.net/getimagesize#37531

    Maybe it usefull to you.



  3. #3
    ethraax is offline x10Hosting Member ethraax is an unknown quantity at this point
    Join Date
    Oct 2007
    Posts
    56

    Re: getimagesize() with remote urls?

    Doesn't work, it won't allow fopen on a remote url either. Thanks for the try though...

  4. #4
    Slothie's Avatar
    Slothie is offline Lord Of The Keys Slothie is an unknown quantity at this point
    Join Date
    Sep 2007
    Location
    Singapore
    Posts
    1,432

    Re: getimagesize() with remote urls?

    Get phpv2. Then curl it , get the size and then delete it.

    Easiest 70 points you'll make on x10

    Feel free to add my reputation by clicking on the if you found my post helpful to you :P


    If I am not responding to your PMs, that means I am ignoring you. Take a hint.



    09 F9 11 02 9D 74 E3 5B D8 41 56 C5 63 56 88 C0


  5. #5
    ethraax is offline x10Hosting Member ethraax is an unknown quantity at this point
    Join Date
    Oct 2007
    Posts
    56

    Re: getimagesize() with remote urls?

    So here's another one... I can't access my account through x10hosting.com (although I can log onto cpanel, my mail, etc).

    :o.

    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 by ethraax; 10-28-2007 at 03:16 PM.

  6. #6
    Bryon is offline Administrator Bryon has disabled reputation
    Join Date
    Apr 2005
    Location
    Northfield, NH
    Posts
    7,608

    Re: getimagesize() with remote urls?

    Is your site still not loading for you? http://ethraax.exofire.net loads fine for me.

    For your problem with PHP, upgrade your account's PHP version to version 2 through the account panel. ( http://x10hosting.com/account ) That should fix the problem that you are having.

  7. #7
    ethraax is offline x10Hosting Member ethraax is an unknown quantity at this point
    Join Date
    Oct 2007
    Posts
    56

    Re: getimagesize() with remote urls?

    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 ^^.

+ Reply to Thread

Similar Threads

  1. Remote MySQL Database Handling
    By virus in forum Scripts & 3rd Party Apps
    Replies: 2
    Last Post: 01-10-2008, 07:34 AM
  2. Remote Mysql
    By sonic in forum Free Hosting
    Replies: 4
    Last Post: 09-05-2007, 05:48 AM
  3. digital.exofire.net \ - remote - assistance - required -
    By kaliforna in forum Scripts & 3rd Party Apps
    Replies: 2
    Last Post: 11-18-2005, 12:31 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
x10hosting free hosting for the masses
dedicated servers