Greenguy's Board


Go Back   Greenguy's Board > Programming & Scripting
Register FAQ Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Rate Thread Display Modes
Old 2007-12-18, 11:15 PM   #1
guschi2k
Heh Heh Heh! Lisa! Vampires are make believe, just like elves and gremlins and eskimos!
 
guschi2k's Avatar
 
Join Date: Oct 2003
Location: right here
Posts: 75
Send a message via ICQ to guschi2k
PHP - How to get dimension of hotlink protected image? (TGP)

Hey all

I'm trying to retrieve the dimensions/resolution of the fullsize images of TGP galleries. getimagesize() is of course not working with hotlink protected images, so I guess the only way is establishing a connetion with fsockopen() and sending false referrer information.

I tried that already and retrieving http status, last modified date, filesize etc is no problem ... but how would I go about the resolution?

I tried sending a "GET /image.jpg" already, but then my browser prompts me to download the file and choses myscript.php as the filename.

My head hurts already :-/ Maybe there's a rather simple solution? Writing the output of the GET request to a temp file on my webspace and doing a getimagesize() was what I thought about ... but it seems a little overcomplicated?
Also ... retrieving all pictures of the ~700-800 tgp gallery submission every day would be quite a waste of bandwidth :-/ and even worse ... when I run my linkbot to check all submitted galleries, this would be ... HOLY MOSES ... too many gigs to count :o


Thanks for aaaaaaaaalllll help
__________________
Tonys XXX Links wants your quality free sites|king|
Pleeeaaase help & save my addiction SaveEnterprise

Last edited by guschi2k; 2007-12-18 at 11:24 PM..
guschi2k is offline   Reply With Quote
Old 2007-12-20, 12:15 AM   #2
tickler
If there is nobody out there, that's a lot of real estate going to waste!
 
tickler's Avatar
 
Join Date: Dec 2003
Posts: 2,177
Post

Actually PHP can bypass hotlinking(If I remember right, from some TGP scripts)

PHP Code:
list($width$height$type$attr) = getimagesize("http://www.example.com/gifs/lo%20go.gif"); 

Also look at this code snippet from my thumbnailer routine:
PHP Code:
$wrkImage imagecreatefromjpeg($rawPicURL);

echo 
imagesx($wrkImage); // image width
echo imagesy($wrkImage); // image height 
__________________
Latina Twins, Solo, NN, Hardcore
Latin Teen Cash
tickler is offline   Reply With Quote
Old 2007-12-20, 01:41 PM   #3
guschi2k
Heh Heh Heh! Lisa! Vampires are make believe, just like elves and gremlins and eskimos!
 
guschi2k's Avatar
 
Join Date: Oct 2003
Location: right here
Posts: 75
Send a message via ICQ to guschi2k
Thanks for your answer Unfortunately it's not working for me, b/c as far as I know getimagesize() cannot bypass hotlinking

I tried it with this image:
http://www.shizzn.com/x/stuff/open/cimg3621.jpg - no hotlink protection
http://www.shizzn.com/x/stuff/prot/cimg3621.jpg - htaccess hotlink protection


I know tried it like that:
Code:
$target_host = "www.shizzn.com";
$target_path = "/x/stuff/prot/cimg3621.jpg";

#header("Content-Type: text/plain");
header("Content-Type: image/jpeg");
    $fp = fsockopen("$target_host", 80, $errno, $errstr, 5);
    if(!$fp){echo "$errstr ($errno)<br>\n";}
    else
      {
      $out = "GET ". $target_path ." HTTP/1.1\r\n";
      $out .= "Host: ". $target_host ."\r\n";
      $out .= "Referer: http://". $target_host ."\r\n";
      $out .= "User-Agent: Blabla Browser Name(xyz)\r\n";
      $out .= "Keep-Alive: 200\r\n";
      $out .= "Connection: Close\r\n\r\n";

      fwrite($fp, $out);
      while (!feof($fp))
        {
        $status_request = fgets($fp, 500000);
        echo  $status_request;
        $file = fopen("temp_img.jpg","w+");
        fwrite($file,$status_request);
        fclose($file);
        }
      fclose($fp);
      }
but somehow it's just not working I'm no PHP expert, though I've been messing with it for years *lol ... if I could ... at least find out a way how to save the image to my server and then do a getimagesize() on the local file?

I just really s*ck! when it comes to file operations *lol If only a head request would also give info about the dimensions I'm using the head request to check the status (redirection, 404 etc) and the image size in bytes, which works perfectly fine
__________________
Tonys XXX Links wants your quality free sites|king|
Pleeeaaase help & save my addiction SaveEnterprise

Last edited by guschi2k; 2007-12-20 at 01:50 PM..
guschi2k is offline   Reply With Quote
Old 2007-12-20, 02:29 PM   #4
Greenguy
The Original Greenguy (Est'd 1996) & AVN HOF Member - I Crop Pics For Thumbs In My Sleep
 
Greenguy's Avatar
 
Join Date: Feb 2003
Location: Blasdell, NY (shithole suburb south of Buffalo)
Posts: 41,929
Send a message via ICQ to Greenguy
Forgive me for sounding naive, but isn't this one of the many reasons that anti-hotlinking protection is in place?
__________________

Promote POV Porn Cash By Building & Submitting Galleries to the Porn Luv Network
Greenguy is offline   Reply With Quote
Old 2007-12-20, 03:32 PM   #5
guschi2k
Heh Heh Heh! Lisa! Vampires are make believe, just like elves and gremlins and eskimos!
 
guschi2k's Avatar
 
Join Date: Oct 2003
Location: right here
Posts: 75
Send a message via ICQ to guschi2k
@greenie, No worries

I haven't used payed scripts for years, but as far as I remember they have anti-cheat mechanisms as well which are supposed to detect redirects, image size, dimensions and stuff. Brownie for example was one of the first - if not the first - scripts to retrieve image sizes and stuff.

So basically I'm just trying to find out how to do, what every good script should be able to do

It just has! to be possible to retrieve the dimensions of images, without downloading it entirely. After all, I want to make it a blazing fast script And right now it's sloooooooow ... but good! *lol


If only all submitters would just stick to the rules of TGPs/MGPs! *lol damn cheaters.
__________________
Tonys XXX Links wants your quality free sites|king|
Pleeeaaase help & save my addiction SaveEnterprise
guschi2k is offline   Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 04:00 PM.


Mark Read
Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
© Greenguy Marketing Inc