thumbalizr Supportforum

thumbalizr Supportforum » Wishlist

api / queued pictures

(8 posts)

Tags:


  1. aproka
    Member

    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

    Posted 3 years ago #
  2. 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 :)

    Posted 3 years ago #
  3. Can you guys serve a header that's like X-Thumbalizr: Queued when you serve a queued image?

    Posted 2 years ago #
  4. We will enhance the headers in beta-stage.

    Posted 2 years ago #
  5. steve
    Member

    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 !

    Posted 2 years ago #
  6. alainravet
    Member

    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
    
    Posted 2 years ago #
  7. 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.

    Posted 2 years ago #
  8. charlene
    Member

    This is a really good read for me.

    ______________________
    cheap NFL jerseysonline shop
    Find the jerseys you need to support your idol.

    Posted 1 month ago #

RSS feed for this topic

Reply

You must log in to post.