After trying 6.x-3.0-alpha1 I'd like to migrate a Drupal website with a quite large number of users and their pictures (nodes of Image type) in Acidfree albums to Node Gallery. However, some issues which definitely will occur during such a migration make me reluctant from starting the process and I would love to hear the module maintainer's and user's opinion.
I think fo the following sequence of steps:
1. Migrate nodes of Image type to nodes with imagefields following #201983: How To: Migrate from Image.module to ImageField Documentation Project;
2. Activate Node Gallery module;
3. Delete Gallery Image node type leaving Gallery node type in tact;
4. Add new relationship on 'admin/settings/node_gallery' for Image node type (with imagefield as per step 1) to attribute it as Image type.
But I am not sure if this way will work out successfully because of two issues:
1. How to migrate per user galleries in Acidfree to Node Gallery?
2. Will Node Gallery pick up previously added images or it deals only with new pictures?
Thank you for your attention.
Comments
Comment #1
scroogie commentedIt will require custom code to create gallery nodes and to attach the image nodes to these. You'll have to traverse the gallery taxonomy vocabulary and create a node for every term, as well as "register" the nodes to these gallery nodes afterwards.
If you want, and are willing to invest some time yourself, we can try to build some code together in this issue. At some point, I'll migrate one of my existing sites to NG3 from image.module, and will need similar code as well.
One additional problem would be that gallery hierarchies are only planned for NG 3.1.
Comment #2
justintime commentedI've never used Acidfree, but I have something that may be of help.
I've a views_bulk_operations junkie, and since I'm the maintainer, I made sure that NG3 worked with it. In NG3, we expose an action that can assign images to galleries. So, if you can come up with a way to isolate images using VBO's filters, then you can do this all via the gui.
However, this sounds like it would be a pretty quick and easy drush script. Once the gallery and image types are part of a relationship, nodeapi takes care of the rest. POC code:
That's all you need to do to build the linkage between gallery and image, but obviously the bulk of the work is in the unwritten get_acidfree_gallery_nids() and get_acidfree_image_nids() functions. If you have a truly large number of images and galleries, I would definitely run this via 'drush scr' so you don't run into execution time issues.
BTW: you're Andy, right?
Comment #3
yngens commentedscroogie, for the sake of making this work for more general purpose let's simplify my sequence and ignore Acdifree albums. Let's try to build a migration path from Images to Imgefields to make them Node Gallery images. If I understand right, then answer to my second question (if Node Gallery will pick up previously added images) is negative, because, as you've put, it should "register" the nodes to gallery nodes, isn't it?
I'll do my best, however I'm not a coder, so would love to get some help here.
justintime, never used drush, but for the sake of solving this issue could learn using it. However, I'm afraid I can't build those get_acidfree_gallery_nids() and get_acidfree_image_nids() functions. Not Andy.
Comment #4
justintime commentedHere's those functions, and a script to boot: http://pastebin.com/0L8RcZmC
scroogie can help you with the image.module to imagefield migration, since he needs to do it anyway. Here's the basics of what you'd do:
1) Install Node Gallery, leave the defaults.
2) Run the script above.
3) Run scroogie's script to convert images to imagefield
4) Uninstall the Acidfree module
5) Enjoy
I didn't test that script above, so please don't even attempt with it until you are working on a development copy of your live site.
To run it, download and install drush according to the docs. Change to your drupal install root, and place the script linked above in a file named acidfree_migrate.php. Then run 'drush scr acidfree_migrate'.
Comment #5
scroogie commentedThe script needs some more work to retrieve the title of the gallery, author, etc. I think you should start with acidfree_get_vocab_id() and then taxonomy_get_term() your way through the galleries. I used acidfree only in Drupal 5, quite some time ago.
Comment #6
yngens commentedThank you guys,
Using #201983: How To: Migrate from Image.module to ImageField Documentation Project I have successfully migrated all the Images on my site to ImageFields. All the album names are converted to taxonomy term names. So now the task is little bit different for me.
I need to 1) turn taxonomy names into Node Gallery albums and 2) make Node Galleries to register all the nodes with imagefields. So not to confuse, if any of the above scripts still applicable, which of them would help me to solve which task?
Comment #7
justintime commentedWell, that's good progress. Next step, create the gallery nodes.
Try using http://drupal.org/project/taxonomy_node to create a node_gallery_gallery node for each of your terms.
Post back whether that succeeds or not. If it works, then it should be a pretty simple script to get the images into the galleries.
Comment #8
yngens commentedjustintime, it has worked, however all the taxonomy terms have been associated with user #1. trying to attribute them back to their owners. unfortunately taxonomy_node module just creates nodes without attributing associated taxonomy terms at the same time. if it did then now would be peace of cake to go through images and bind each of them to associated gallery. what would be the next step?
Comment #9
yngens commentedOn admin/settings/node_gallery/relationship/content_types/1 wanted to change only the content type to Image type, but it did not let me to, giving the error: "The node_gallery_gallery type is already part of a relationship." So I deleted and re-created the relationship, but now on attempt to edit an image node and assign it to a gallery, it gives "Unable to find a navigator image sort view. Please revisit your node gallery relationship settings." and fails to assign to any gallery. Revisiting settings page does not help.
Comment #10
justintime commentedOkay, wrt "The node_gallery_gallery type is already part of a relationship.", that was a validation bug that I've fixed in dev.
As for your problem in saving, I'm not for sure where the problem is at. Can you give me:
1) The content types in your relationship
2) The content type of the image you're editing
3) What user you're editing the image with
4) The title of the gallery you're selecting in the "Assign to Gallery:" select box
5) The content type of the gallery selected in 4)
Comment #11
justintime commentedOh, and of course, clear your caches first if you haven't already.
Comment #12
yngens commented6.x-3.x-dev of 2010-Dec-02 still gives 'The node_gallery_gallery type is already part of a relationship' error.
1) Gallery Type: Gallery of 'node_gallery_gallery' type (Original),
Image Type: Gallery Image of 'node_gallery_image' type (Recreated. Original one was deleted and node type of 'imapgepage' with 'field_imagefield' field, which holds all my images, has ben reneamed node_gallery_image)
2) node_gallery_image
3) User #1
4) It's username of user #1, because gallery names have been retrieved from per user gallery taxonomies. However, as I understand titel of the gallery can be anythign here, right?
5) Gallery
Clearing cache did not help.
I'm afraid something with views broken when I had deleted 'node_gallery_image' and renamed one of the previously existed content types to 'node_gallery_image'. I tried, but could not find any differences in views or Gallery Node settings. The only difference is that imagefield of my 'node_gallery_image' is called 'field_imagefield'.
Does Relationship ID play any role here? Current rid is 3, two previous ones have been deleted because of 'The node_gallery_gallery type is already part of a relationship' error message.
Comment #13
justintime commented@yngens - I commited the fix for 'The node_gallery_gallery type is already part of a relationship' this morning, you'll need a dev build after that.
I found and fixed the bug in dev that was causing yngens to not be able to manually assign pre-existing image nodes to galleries. @yngens, I left the fixed file in place on your server, so you don't need to wait for a dev build.
Comment #14
yngens commentedJustintime, thank you very much! This allows me to place tons of pre-existing images into Node Galleries. tamerzg have been helping me to Migrate images from AcidFree and Gallery2 to Node Gallery. As soon as the whole process is done we will be contributing all the migration scripts to the community and then this issue could be considered solved.
Comment #15
yngens commentedjustintime, in #7 you mentioned that if it works, then it should be a pretty simple script to get the images into the galleries. Adding manually couple of images I can see changes in database, but to make sure that kind of scripts makes changed on all the needed places, can you please confirm changes to which database tables should be made by the script to add pre-existing images to pre-existing galleries? Is biding correct nids and gids in node_gallery_images table sufficient?
Comment #16
justintime commentedhttp://pastebin.com/rLN3tYj5
You owe me a lot of beer, or a lot of documentation :)
Put that script someplace, like /tmp/ng_migrate.php. cd into your drupal root directory, and run the script: 'php /tmp/ng_migrate.php'. In it's current form, it will not change anything, just print out how many images it finds for each gallery.
If that looks right, remove the comment from the drupal_write_record() and the node_save() lines. PLEASE FOR THE LOVE OF GOD BACKUP YOUR DB FIRST. I haven't tested it - it should work, but I claim no reponsibility for anything in it.
Comment #17
justintime commentedIf that script works, please post the code back to this issue for safekeeping.
Comment #18
yngens commentedYee, it works. Actually, I'm still running the script. Had to increase php memory for it. I hope running several times does not double the images or hurt otherwise.
About beer, yes i do :) where in us you are? If in bay area then be my guest for drinking real, not virtual bear :) I also hope that in result of this issue the Drupal community will have safe path of migrating to Node Gallery from other gallery modules. I will contribute all the scripts, that Tamer wrote for me too.
P.S. I know separate issue should be created, but maybe it is too simple: Would be nice to place links to galleries on user's profile. Is this easily configurable?
Update: Still have been running the script over and over again, because it spits out the list of galleries with different numbers of images in them. The upper part of the list, seems have been stabilized, but every time scripts add some new galleries in the end part. I think with every refresh of the page the scripts starts to go through all the images, even those which have already been processed. Would be nice if it process only the rest of the images. The script, at least in my case, never reaches its last line: echo "Migrated $galleries galleries and $total_images images to Node Gallery\n";
Can this procedure use Drupal's batch function instead?
Comment #19
justintime commentedUpdated the link above to http://pastebin.com/rLN3tYj5
This should be more efficient on memory, and also skip any images that are already part of the gallery.
RE: user profile: http://drupal.org/project/node_gallery_user_profile
Shouldn't need batch API if you're running at the command line with the cache clearing that the new version does.
Comment #20
yngens commentedjustintime, thanks for the second script. It definitely works better, because after several refreshing it finally reached end of the script and gave a report message. However, browsing through galleries and image nodes shows there are still empty galleries and unassigned images. Could you please confirm the followings:
1) Empty galleries are left because some images were associated with several taxonomy terms.
2) Leftout images were not associated with any taxonomies.
3) If the scripts made to the final report message, then all the images associated with taxonomy terms have been imported to galleries and no chance that any single image could be omitted.
Or there might be some exclusions?
Comment #21
yngens commentedJust have looked at admin/reports/dblog and found out the script have been giving an error message:
Comment #22
yngens commentedI have been attributing all the orphan images with Views Bulk Operations and, because have read on the other thread that it is not possible for now to add an image to two or more galleries, will delete all the empty galleries.
Comment #23
justintime commentedThat's right - one gallery per image, no subgalleries. So, regarding #20, 1, 2, and 3 are all correct afaik. The error in #21 is non-fatal, it just means that we're looking inside an empty gallery.
Comment #24
yngens commentedHave been running VBO successfully for some time (I have lot's of images, so it will take some time to sort them all out), but suddenly the view stopped working. Log gives the following, though I am not sure if it is related to the Node Gallery module. Posting it here, because I encountered this solving the issue of the thread and because node_gallery_gallery_image_views is mentioned in the error report.
Comment #25
justintime commentedLooks like this is a known views issue: http://drupal.org/node/989092
Comment #26
pepemty commentedsubscribing
Comment #27
nasi commentedIs there an update on this? I am now in exactly the same position of migrating image galleries from Image and Image Gallery to Node Gallery.
I have got as far as migrating all the images to use image field, so now I just need to create the gallery nodes and build the relationships of images to galleries. Things should be a little simpler for me as I have a 1:1 image:gallery relationship and no user galleries to worry about.
Is the script linked in #19 still the best way to go? How did you get on with VBO, was that better? It would be great to see updated/definitive scripts posted back here.
Comment #28
nasi commentedOk, here is the script that I have written to do the migration in a (hopefully) safe manner. I've run it a few times and all seems to work, but YMMV.
Perhaps this should go into a documentation page?
Comment #29
justintime commentedAdding to documentation queue - thanks for the contribution!
Comment #30
izmeez commentedsubscribing
Comment #31
nasi commentedOne additional limitation worth pointing out (that I have since discovered); This script will not populate the teaser field of the new gallery nodes. So gallery descriptions will appear in the gallery body but not in teaser displays.
The way I solved this was to edit and save each gallery node by hand, but that would be impractical for a site with a lot of galleries. So anyone planning to use this script on a large scale may want to first work out how to also save the teaser, correctly truncated.
I have edited the script above to reflect this.
Comment #32
justintime commentedupdateing component