[Typo3-dev] caching, CLI, and IMG_RESOURCE
Zach Davis
zach at crito.org
Fri Jan 7 04:58:17 CET 2005
I'm a bit stumped with a typo3 problem; maybe somebody here can help.
So, I wrote an extension for a client -- basically it's an image gallery
with 1000+ image records. Each image file is displayed as an IMAGE
cObject, which means that the first time an image is displayed it's
resized and cached (a version of the file is created in typo3temp and 2
corresponding records are recorded in cach_imagesizes).
Here's the problem: every now and then the client needs to crawl the
gallery and cache every image. It's very time consuming and CPU
intensive, so my preference is to make it something that can be run via
cron or, even better, from the command line. It's easy to write a view
for the extension that goes through the table and calls cObj->image on
each record to generate the cached file, but it takes too long and it
times out.
So, I used the CLI API (Rainer's approach of using $_SERVER['argv'][0]
for the PATH_thisScript value, incidentally, works fine in redhat linux)
to set up a script that can be called from the command line -- so far so
good. Ideally, I'd like the script to be able to go through the database
and call the same cObj->IMAGE method that's called in the frontend when
the records are displayed. This is where I'm stuck -- seems to me that
this cObject method is only available in the frontend.
My question, I guess, is this: Is it possible to call
cObj->IMAGE_RESOURCE from a backend CLI script so that all my images can
get cached?
Your help is, as always, much appreciated.
best wishes,
Zach
More information about the TYPO3-dev
mailing list