|
|
|
|
|
|
|
|
|||||||
![]() |
|
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
|
#1 |
|
Heh Heh Heh! Lisa! Vampires are make believe, just like elves and gremlins and eskimos!
|
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-19 at 12:24 AM.. |
|
|
|
|
|
#2 |
|
If there is nobody out there, that's a lot of real estate going to waste!
Join Date: Dec 2003
Posts: 2,177
|
Actually PHP can bypass hotlinking(If I remember right, from some TGP scripts)
PHP Code:
Also look at this code snippet from my thumbnailer routine: PHP Code:
|
|
|
|
|
|
#3 |
|
Heh Heh Heh! Lisa! Vampires are make believe, just like elves and gremlins and eskimos!
|
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);
}
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 02:50 PM.. |
|
|
|
|
|
#4 |
|
The Original Greenguy (Est'd 1996) & AVN HOF Member - I Crop Pics For Thumbs In My Sleep
|
Forgive me for sounding naive, but isn't this one of the many reasons that anti-hotlinking protection is in place?
|
|
|
|
|
|
#5 |
|
Heh Heh Heh! Lisa! Vampires are make believe, just like elves and gremlins and eskimos!
|
@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! *lolIf 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 |
|
|
|
![]() |
|
|