AW: [PHP] Help with PNG creation script

From: Marcus Wendt (m_at_euda.org)
Date: 12/31/03

  • Next message: Scott Fletcher: "Re: [PHP] What is the Basic function to encode the password upon the authentication.."
    To: "'Ashley M. Kirchner'" <ashley@pcraft.com>, <php-general@lists.php.net>
    Date: Wed, 31 Dec 2003 11:28:57 +0100
    
    

    I'd definitivly suggest you NOT to use this database-pointer approach!

    Instead of simply sending that .png-header once
    you could store the image in a physical file by using an unique ID based
    on the functions arguments.
    Later on just check if a file with this ID exists and return its URL
    instead of calling that function again.

    I have recently written such a script (to be used as smarty-plugin) tell
    me if you want to have a look at it.

    -----Ursprüngliche Nachricht-----
    Von: Ashley M. Kirchner [mailto:ashley@pcraft.com]
    Gesendet: Mittwoch, 31. Dezember 2003 11:04
    An: php-general@lists.php.net
    Betreff: [PHP] Help with PNG creation script

        The attached text file contains a script that I've gotten from a web

    site and that I've been using for a while now to generate on the fly PNG

    headers. There can be several headers on one page, spanning several
    days worth of articles. The script works, except it's a huge overhead
    because it generates each header every time it gets displayed. What I'd

    like to do is amend the script to where it will creates a physical PNG
    file on the server, so that the next time it's called, it will check its

    "cache" first to see if that particular header already exists before
    creating another. Basically something to the tune of:

        a web page calls the script:

        script checks internal cache for that header
          if header doesn't exist
            create header -> save in cache (disk based?)
          endif
          serve header from cache
        end routine

        I don't know if it makes sense to incorporate this with an MySQL
    database which contains pointers to the physical files on disk. I don't

    know if that will speed up the searching for a particular header
    (searching the DB, as opposed to scanning the disk directory.) The only

    thing I can think of is to have a database with a table that contains
    both article dates as well as the pointer, so the search only has to go
    through a small set of records, as opposed to the whole DB, but is it
    really worth it?

        Now, somewhere in there, it also needs to scan the cache for old
    headers that are no longer needed, based on a time frame that I set
    (maybe 14 days? maybe 30 days? I haven't decided yet.) Again, maybe
    using a DB is worth it so one can simply delete all the pointers and
    physical files confirming to a specific range search in the DB? Right
    now, I just want the thing to cut down on CPU usage because it's
    generating those headers every time a page gets called. Not good.
         

    -- 
    W | I haven't lost my mind; it's backed up on tape somewhere.
      +--------------------------------------------------------------------
      Ashley M. Kirchner <mailto:ashley@pcraft.com>   .   303.442.6410 x130
      IT Director / SysAdmin / WebSmith             .     800.441.3873 x130
      Photo Craft Laboratories, Inc.            .     3550 Arapahoe Ave. #6
      http://www.pcraft.com ..... .  .    .       Boulder, CO 80303, U.S.A.
    

  • Next message: Scott Fletcher: "Re: [PHP] What is the Basic function to encode the password upon the authentication.."

    Relevant Pages

    • filegroup question
      ... If your database is very large and very busy, multiple files can be used to ... But if the table were divided into three physical files (all part ... addition, if each file were on its own separate physical disk or disk array, ...
      (microsoft.public.sqlserver.server)
    • Re: Logical & Physical files relationships
      ... I had always assumed though that SQL Server used its logical names to ... 'look-up' the physical files, which is why I was confused as to the ... > It looks to me like Wayne assumes you are overwriting an existing database ... > during the restore. ...
      (microsoft.public.sqlserver.server)
    • Re: Logical & Physical files relationships
      ... Logical file names are only used in Transact-SQL statements (e.g. RESTORE, ... DBCC, CREATE/ALTER DATABASE, etc.) as user-friendly names to 'look-up' ... SQL Server MVP ... > 'look-up' the physical files, which is why I was confused as to the ...
      (microsoft.public.sqlserver.server)
    • Spread table.
      ... If your database is very large and very busy, multiple files can be used to ... But if the table were divided into three physical files ... if each file were on its own separate disk ...
      (microsoft.public.sqlserver.clients)
    • RE: how to backup STS
      ... You can backup the database with the help of the following link. ... you need to backup the physical files associated ... This posting is provided "as is" with no warranties and confers no rights. ...
      (microsoft.public.sharepoint.teamservices)