[ic] howto do if file exists

Mike Heins interchange-users@icdevgroup.org
Sun Apr 20 09:07:01 2003


Quoting Paul Jordan (paul@gishnetwork.com):
> >
> > Aha, there is one. I think ReiserFS is a default option for Linux
> > "mkfs", so that would be viable.
> >
> > Still in all, it might be nice to have some management for images in IC.
> > I was thinking of:
> >
> >     1. Images table in database.
> >
> >     2. The image tag checks for file, if not gives URL to IC-based page
> >        that pulls image from table and writes to file system.
> >
> >     3. Optional entry to map image to hashed directory.
> >
> >     4. External check script (just DBI) which removes directory and
> >        rewrites all images in hashed directories based on some algorithm
> >        -- and saves results appropriately in products table.
> >
> >     5. The reverse script which pulls in an image directory to the
> >        table; must have "items" and "thumb" directory to read which are
> >        product images and which are regular images.
> >
> >     6. Auto thumbnail generation.
> >
> >     7. Change image upload to go to image table instead of to file
> >        system.
> >
> > It would probably take me about a day to get it mostly done; but it
> > would take 4 or 5 more days to document and refine and test. It would be
> > too much of a support hassle for the list with the amount of time I can
> > afford to spend on it, so I probably shouldn't do it. 8-}
> 
> 
> What is this discussion about? Is there really a degradation directly
> proportionate only to the number of files in a directory? Or is there
> another force (traffic?)

Absolutely. Directory scans are sequential in most file systems, and 
the larger the directory the longer the scan time and the more blocks
that need to be transferred to do the scan.

And if you need to check for the file too, obviously you have to do
it twice.

> 
> #2 #5? Are these just two sides of the same coin? Those that choose to store
> in table, or those that choose to store in a dir? Or, if I understand #2, it
> would allow for a mixture of both...

If you wanted to store it only in the table, then you would issue a URL for
an external lightweight script that would deliver the image from the
table.

> This seems like alot more work (for IC) (no?) but if there are strong
> arguments for improvement in this area, I would like to hear more about this
> bullet list. limits? If someone NEVER needs to check [if] the image is
> there, does it make a difference?

You only have to do one directory lookup -- when it is transferred.

> Also, as for the last statement, has the devgroup thought about having a
> list (forum tag?) for devgroup members, or registered users to post (larger)
> jobs? I say this because (as per the above) a few days of [email-param
> consultant] time can cost more than a can of pepper. I wouldn't mind seeing
> a place that had jobs that were > $1000 and had the ability to pool money
> together (users). So, a few people who are interested can bid/pitch in
> $500... Maybe it could be a place for the IC users to collaborate, and hash
> out their own consortium paid jobs?? I know I would be interested in making
> my money go farther... and would spend more if I knew I was getting a well
> hashed out idea (multi users input) and exponentially more value directly
> proportionate to the money I spend....
> 
> I really think alot more could get paid for if the cost came down for the
> 40% that *would* pay, as opposed to the 10% that *can* pay. (if this is
> un-opensource like, sorry, but it seems to make sense)
> 
> Anyways, I barely know about the above, but it sounds like something I would
> like to pool money into...

That I can't speak to -- herding cats is not my specialty. 8-)

-- 
Mike Heins
Perusion -- Expert Interchange Consulting    http://www.perusion.com/
phone +1.513.523.7621      <mike@perusion.com>

I don't want to get to the end of my life and find I have just
lived the length of it. I want to have lived the width of it as
well. -- Diane Ackerman