The Image Attach Migrate module resolved the issue of migration image attach nodes from Drupal 6 to Drupal 7. In Drupal 6, to add pictures to posts was using a combination of the image module with the image attach module. Now in Drupal 7 Imagecache and ImageField is incorporated into Drupal 7 core and renamed 'Image'.
Usage:
- Backup your Drupal database.
- Go to admin/config/media/image-node-attach.
- Select the content type(s) to which all your images will be migrated.
- Run this migration script by clicking on submit button.
After running this module, you will found there is entity reference field (field_image_node_attach) available in every content type selected from configuration page and all relevant image are migrated there.

There would be a custom formatter (Entity Reference Image Formatter) available on 'Manage Display' page for this field in every selected content type.

Module Link:
https://www.drupal.org/sandbox/er.pushpinderrana/2297739
git clone --branch 7.x-1.x http://git.drupal.org/sandbox/er.pushpinderrana/2297739.git
Reviews:
https://www.drupal.org/node/2308823#comment-8994565
https://www.drupal.org/node/2298271#comment-8951589
https://www.drupal.org/node/2274105#comment-8951615
https://www.drupal.org/node/2288977#comment-8951653
https://www.drupal.org/node/2300519#comment-8965469
https://www.drupal.org/node/2298271#comment-8965457
https://www.drupal.org/node/2284835#comment-8976115
| Comment | File | Size | Author |
|---|---|---|---|
| #6 | formatter1.png | 9.75 KB | pushpinderchauhan |
| #6 | image_attach_field.png | 7.93 KB | pushpinderchauhan |
Comments
Comment #1
joachim commentedI'm very pleased to see that someone's tackling this! Do please make it known on the very very long issue about the old contrib Image module's D7 upgrade path!
One thing that came up a lot is that there's more than one way to migrate attached images -- you could keep your image nodes as nodes, and use entityreference to point to them, and then have a custom formatter; or you could lose the image node and have a simple image field (and then have to figure out a strategy for dealing with an image node that's attached to more than one content node).
That's not the right way to do this at all. Use the batch sandbox to store details from one batch iteration to the next, it's what it's there to do.
Though I don't know why you need this anyway:
It's not customary to bother with saying how many requests were needed.
At any rate, use the sandbox and all the code surrounding this will boil down to 2 lines: one to initialize and one to increment.
That's not the best way to use BatchAPI. You should only add the operation once, and let the operation iterate over a set number of results, using the sandbox to mark how far it got each time.
Though a bigger issue is that as you've called your module 'migrate', I assumed you'd be building on top of Migrate module...
Comment #2
gaurav.pahuja commentedPlease run PAreview.sh once. I found multiple issues in your module.
USe URL: http://pareview.sh/
Comment #3
pushpinderchauhan commented@gaurav.pahuja and @joachim, thanks!
@joachim, Great thanks to you to review this module so soon. Sorry for delayed replying as I was tried your suggested approach in my current project and I found your approach looks more generic. So I make following changes:
I keep image nodes as nodes and use entityreference with custom formatter. Even I am not facing any issue with existing approach but this one looks good and more generic so going with this.
Yes now I am using BatchApi sandbox with specific feature that required here.
This time I added the operation once and iterate the same on specific nodes.
I have changed the module name from
image_attach_migratetoimage_node_attach.@gaurav.pahuja, as the code is completely changed now, so after fixing all issues posted by http://pareview.sh/ will move to Need Review.
Thankyou again!
Comment #4
pushpinderchauhan commented@gaurav.pahuja and @joachim, please review the updated code.
@gaurav.pahuja, I have fixed all issues of http://pareview.sh/, please review.
@joachim, Please do share your thoughts on this, it would help me to make this module more reliable and robust.
Thanks!
Comment #5
PA robot commentedWe are currently quite busy with all the project applications and we prefer projects with a review bonus. Please help reviewing and put yourself on the high priority list, then we will take a look at your project right away :-)
Also, you should get your friends, colleagues or other community members involved to review this application. Let them go through the review checklist and post a comment that sets this issue to "needs work" (they found some problems with the project) or "reviewed & tested by the community" (they found no major flaws).
I'm a robot and this is an automated message from Project Applications Scraper.
Comment #6
pushpinderchauhan commentedComment #7
gaurav.pahuja commentedManually reviewed your code. It seems to be changed completely from last revision. Now it makes more sense to have images as node. I am going to test it fully on a migration environment and let you know the comments.
Can we have configurable node limit that you used in batch? Currently it is hard coded to 50.
Comment #8
pushpinderchauhan commented@gaurav.pahuja, thanks for review.
I am awaiting for your comments.
Yes, we can have a configurable node limit but it would make the user little bit confused at this stage. I think 50 is safe number to process within a single batch without a timeout.
But if you think it is required, I can add the same on configuration page.
Thanks again!
Comment #9
gaurav.pahuja commentedAutomated Review
PAReview doesnt reported any issue in current build.
Manual Review
Tried migrating images content from one of the existing Drupal 6 site to new Drupal 7 vanilla. Worked for me.
Duplication
No. Googling for drupal does not find an existing module that does this. Though found one similar custom PHP script. A full fledge module would be helpful.
Master Branch
No.
Project page
Exists. Module name changed to make it more informative.
README.txt
Yes: Followed steps from Readme file and Help page and able to complete image attach migration.
Code long/complex enough for review
Yes
Secure code
Yes: Follows guidelines for writing secure code. (There isn't much to review, but I didn't find anything wrong with the code submitted.)
Coding style & Drupal API usage
There isn't much to review, but I didn't find anything wrong with the code submitted.
There are IMHO no blockers, so I am giving +1. Let somebody else also review this module then it can be moved to RTBC.
Comment #10
chetan-singhal commented@er.pushpinderrana
Nice Module
There are few issue
1. line no-100, image_node_attach.module file Please also check
otherwise if array empty it give php warning undefined index.
2. intially assign
to FALSE in your function image_node_attach_field_formatter_view. so you not need to check isset again and again in your foreach loop. Then only check
3. Line no 212
function. In this function $item variable may has other attributes like 'error'. so also manage rest attributes.
Comment #11
pushpinderchauhan commented@gaurav.pahuja, thanks for your feedback.
@chetan_singhal, thanks for your review. I deeply analyze each point, adding my comment with each.
I am also checking 0th index here, so there is no need to separately check for array. Below is my code.
Here $link_file is declared in else condition so when it is going to if condition then variable is not declared as shown in below code
That's why I am checking isset with following code.
I am doing theming here within this function of custom formatter and 'error' attribute is not available here. That's why error attribute is not declared here.
Thanks again @chetan_singhal for review!
Comment #12
chetan-singhal commentedComment #13
pushpinderchauhan commented@chetan_singhal, thanks for your review and quick reply.
If you have anything to say about my coding standard or documentation (any particular thing that can be improved), I would appreciate that.
I would also appreciate git admin users to review this ASAP, as lot of people experiencing this issue that would resolved through this module.
Though, I am working as a co-maintainer in other projects but never get time to contribute a complete module. I actively contribute on drupal forums and core issues. I just experienced this issue in past, did lot of researched on this but at the end write my own custom script for this. As most of people avoid to write own custom script so I developed this module but currently don't have permission to promote sandbox projects. So it would be great if any user from git admin look into this module once and share feedback on this.
Thankyou for your time!
Comment #14
mpdonadio@er.pushpinderrana, the review process has been backed up, but some new admins have come on and we are working on clearing this out as quickly as we can (without compromising the review process). Unfortunately, this is a new application and older projects have priority. There are currently four RTBC applications before you, so it will be a few days before we can take a look at this.
Comment #15
pushpinderchauhan commented@mpdonadio, Great thanks to you for quick reply. I am completely agree with you on this and I'll also follow the complete review process.
Thanks again!
Comment #16
chetan-singhal commentedadd a tag
Comment #17
pushpinderchauhan commentedComment #18
pushpinderchauhan commentedComment #19
chetan-singhal commentedRemoving "PAReview: Single project promote" tag as by mistaken added. Everything is looking good to me, it is ready to go.
Comment #20
pushpinderchauhan commentedComment #21
klausiGit default branch is not set, see the documentation on setting a default branch.
manual review:
The misleading and undefined permission is a blocker right now, otherwise this would seem good to go.
Comment #22
pushpinderchauhan commented@klausi, thankyou for your review and valuable feedback!
I am done with all your suggested points, please review.
1. Git default branch is not set, see the documentation on setting a default branch. [DONE]
2. Project page: "There was a module in Drupal 6 that are deprecated in Drupal 7". Which one is it? Please provide a link. [DONE]
> Link added on project page.
3. "'access arguments' => array('administer access'),": that permission is not defined by your module in hook_permission()? Also the permission name does not really fit? Shouldn't it be "administer image node migration" or something similar? [DONE]
4. "'#default_value' => variable_get('image_node_attach_content_type_names'),": [DONE]
> Very good caught, there is no need of default value, removed it.
Thanks again!
Comment #23
pushpinderchauhan commentedComment #24
ratanphp commented1) PAReview is clear.
2) I did a manual review of this project as well. I also installed your module, and test functionally, it works fine. I can see all the points are fixed mentioned by @klausi.
It looks RTBC to me but I am not the right person that makes the final decision. Someone from git administrator look into this and will take a final call on this.
Comment #25
klausiThis looks good to me now after a manual review, so ...
Thanks for your contribution, er.pushpinderrana!
I updated your account so you can promote this to a full project and also create new projects as either a sandbox or a "full" project.
Here are some recommended readings to help with excellent maintainership:
You can find lots more contributors chatting on IRC in #drupal-contribute. So, come hang out and stay involved!
Thanks, also, for your patience with the review process. Anyone is welcome to participate in the review process. Please consider reviewing other projects that are pending review. I encourage you to learn more about that process and join the group of reviewers.
Thanks to the dedicated reviewer(s) as well.
Comment #26
pushpinderchauhan commented@klausi, thanks a lot!
Thanks to all the reviewers.