Hello,
Is there any way that a queued picture can be detected from js?
I think it would need a js api, but do you have anything in mind?
thanks,
Aron
Hello,
Is there any way that a queued picture can be detected from js?
I think it would need a js api, but do you have anything in mind?
thanks,
Aron
Hi aproka,
at the moment there is no way to detect the status of a picture, if it is in qeued mode or already served. Nice idea, though - we will consider it in the next version :)
Can you guys serve a header that's like X-Thumbalizr: Queued when you serve a queued image?
We will enhance the headers in beta-stage.
Hi, I created a little PHP function to check if the thumbnail has been created and is no longer showing the temporary thumbnail.
function isNewThumb($url)
{
$thumbalizrImageCRC = 1342048557;
$fp = fopen($url,"rb");
$tcheck = fread($fp,1024);
fclose($fp);
$tCRC=0;
if ($tcheck)
$tCRC = crc32($tcheck);
return !($tCRC == $thumbalizrImageCRC);
}
Ok, I know this is tricky if the temporary thumbnail image changes, but for now it helps. And in if the temp thumb changes anyway, you only have to recalculate the CRC. The CRC is calculated by using the first 1024 bytes of the file.
Thanks for this great service, keep up to good work !
Here is the Ruby version (add more crc values for other resolutions):
require 'open-uri'
require 'zlib'
include Zlib
def queued_image?(path, size)
file_crc32 = crc32(open(path).read)
case size
when 100 then 1699002568 == file_crc32
when 120 then 1958777770 == file_crc32
when 200 then 2340983175 == file_crc32
when 150 then 3582175601 == file_crc32
else false
end
end
We've been doing similar things in PHP but lately the CRC's appear not to work (we suspect they may have changed).
Or it's possible that the file being downloaded isn't complete - i.e. we catch it mid-write - we're not sure.
This is a really good read for me.
______________________
cheap NFL jerseysonline shop
Find the jerseys you need to support your idol.
You must log in to post.