Needs review
Project:
ImageCache
Version:
6.x-2.0-beta12
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
24 Sep 2009 at 19:21 UTC
Updated:
3 Jun 2012 at 00:53 UTC
Jump to comment: Most recent file
Comments
Comment #1
jhedstromChanging the status.
Comment #2
jwhat commentedAlmost a year later, but I just found this and it was very useful. I modified the file to work with the latest version of Drush: added an alias, replaced realpath with DRUPAL_ROOT (global setting from Drush), replaced space with hyphen in the command name, replaced the messages with drupal_log() in case this is used in a more automated fashion it will save to the log, and added a message if the preset exists yet was already empty.
File attached.
Comment #3
robby.smith commentedvery cool work! drush is very very helpful =)
Comment #4
jwhat commentedI'm going to add the functionality that will present you with a list of your imagecache presets if none were included, because I've realized that I have about 20 and I can't possibly memorize all of their names. I will do this soon and commit an updated patch.
Comment #5
simeYou don't know you want it until you need it.
Comment #6
asciikewl commentedThe patches above were doing funny things, so after a bit of cleanup I implemented listing the presets if you don't give a preset and I implemented "all" for flushing all of the presets, which is often what you need after moving or cloning a site.
Modified version of imagecache.drush.inc.txt attached as I couldn't get a clean initial file for patching.
Pls mv imagecache.drush.inc.txt imagecache.drush.inc d.o doesn't like .inc attachments.
Comment #7
cyberwolf commentedSubscribing.
Comment #8
phayes commentedAttached is an updated file for drush integration
I've added a second command "imagecache build", that will run through all image files in the files table and process image caches for them.
This is useful for for those that want to 'pre-process' all their files.
The one issue I ran into is that both imagemagick and GD died a horrible messy death when being called from php-cli, so I need to route the image-cache call through a
fopen('http://www.example.com')type functionComment #9
moshe weitzman commentedFYI, I committed an image-flush to drush core. D7 only. I'm interested in image-build but am hoping someone can contribute that.
In the meanwhile, this looks useful for d6.
Comment #10
mikeytown2 commentedI have a bash script for running drush commands. Due to imageapi using document_root it fails. BTW, I've modified the drush script to not use http requests.
Bash Script:
What I do is take the last command and see if it's a dir. If it is then set
$_SERVER['DOCUMENT_ROOT']to it.Going to reopen this issue #549074: DOCUMENT_ROOT is empty when using cli php
Comment #11
mikeytown2 commentedThis give percent done updates & it's a little more verbose.
Comment #12
chadwick wood commentedI'm trying to use this patch for the added imagecache build support, but I'm getting an error because my version of imagecache (6.x-2.0-beta10) doesn't have any function named "imagecache_generate_image". Has this function been added in one of the latest development builds or something?
Comment #13
mikeytown2 commentedthat is correct; imagecache_generate_image is in the latest dev. Thats why in #10 I changed the version to 6.x-2.x-dev
Comment #14
boran commentedHas this feature been rolled into a drush release by now, or must one still patch drush?
Aside: I was wonder if this could somehow be used to attach images that have already been uploaded as files (e.g. by ftp), attach them to a node and build the imagecache images?
Comment #15
mikeytown2 commentedno need to patch drush; one must patch imagecache
Look at imageinfo cache to auto build imagecache presets on file upload.
Comment #16
drewish commentedI switched around some of the argument handling to simplify it and use "drush cc" style prompting. Also changed the command names in the examples to match the current values.
Comment #17
drewish commentedWhy are we taking the site root as an option for the imagecache-build? That to make imagemagick happy? We should document that bit of weirdness better.
Comment #18
mikeytown2 commentedthe path hack is a workaround for this issue #360193: ImageAPI Broken - base_path() problem
Comment #19
drewish commentedOkay so I committed the patch for #360193: ImageAPI Broken - base_path() problem so we should test if we still need the URL for that... actually doesn't drush have that information? Should we really need to replicate it?
Comment #20
mikeytown2 commented#1112428: Memory Leak is something to be aware of, if your going to (ab)use this code path. What do you mean by the URL? Not sure if this (the URL) is what your talking about but #549074-3: DOCUMENT_ROOT is empty when using cli php might help to answer your question???
In #10 I don't use a URL
Comment #21
drewish commentedI ment that we shouldn't ever have to ask the users what the site root is. Drush already knows:
But the getcwd() seems to do the right thing in this case:
So I think we can just drop that code.
Comment #22
drewish commentedI'm actually asking Drush what the site root is with
drush_get_context('DRUSH_DRUPAL_ROOT');Comment #23
drewish commentedI went ahead and committed this to 6.x-2.x.
Comment #24
ao2 commentedHi, I've just tested
drush imagecache-buildand I get this message:several times, this happens because I have few images (19), this instruction gives 0:
and then the subsequent modulo operation is not defined.
I also didn't understand what the 200 is used for.
Thanks,
Antonio
Comment #25
drewish commentedI believe it was to break the it up into chunks so the status messages could be output periodically. There might be a better way to achieve this.
Comment #26
dshumaker commentedsubscribing.
Comment #28
ao2 commentedreopening. Am I the only one who got the message like in #24?
Comment #29
ziomizar commentedHi , i have noticed an other issue on the number of items returned.
If i do this query:
"SELECT filepath FROM {files} where filemime LIKE 'image%' ORDER BY fid DESC"
phpmyadmin returns 1104 images, but when i run this script from drush i get only 190 images.
i have changed the script as follow :
// Get a list of files to processes.
$file_query = db_query("SELECT filepath FROM {files} where filemime LIKE 'image%' ORDER BY fid DESC");
$files = array();
drush_log(dt('Generating file list...', array()), 'ok');
while ($filepath = db_fetch_object($file_query)) {
if (file_exists($filepath->filepath)) {
$files[] = $filepath->filepath;
}
}
Now i get correctly all images. I'm sorry but i can't do a real patch, this is my entire file.
Comment #30
ziomizar commentedI have done the patch based on 6.x-2.0-beta12 related to the last post.
the patch fix :
- number of images returned
- current drush dir
Comment #31
ziomizar commentedComment #32
ao2 commented@drewish: the attached patch fixes the problem in #24, it can be applied using
git amso to preserve my authorship in the commit history.I didn't experience the issue @ziomizar had, so I cannot comment on his changes, I just know that they did not fixed my own issue.
Thanks,
Antonio
Comment #33
nicholas.alipaz commentedWow, this seems to be just languishing here... Any movement on getting the drush integration?
Comment #34
mikeytown2 commentedfind me at drupal con during any one of my code sprint times; we can test and get the latest patch in. http://denver2012.drupal.org/sprints
Comment #35
fizk commentedMarking as ImageCache 3.x Todo.