Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
drupal 6.4 (just upgraded)
cck-6.x-2.0-rc6
imagefield-6.x-3.0-alpha1
files and tmp directory 775
download public
When I upgraded to the new cck and drupal core (and imagefield, imageapi, imagecache, filefield) today I lost all my images.
It's not that the browser is unable to find them, they are not even called upon in the HTML. if I edit a node the field is blank.
Is this expected, do I just need to suck it up and re-upload? Or should the transition be smooth?
Comment | File | Size | Author |
---|---|---|---|
#44 | 26195-Imagefield_6_update_2.patch | 11.17 KB | webernet |
#38 | Screenshot-4.png | 38 KB | jeeves |
#33 | 26195-Imagefield_6_update.patch | 11.18 KB | webernet |
#32 | 296195-imagefield-upgrade-path.patch | 11.29 KB | Damien Tournoud |
#25 | image-to-imagefield_widget.patch | 2.66 KB | guillaume.outters |
Comments
Comment #1
stellarvisions CreditAttribution: stellarvisions commentedforgot to say:
upgraded from imagefield-6.x-3.x, CCK 6.2.rc3, drupal 6.3
Comment #2
theactiveme CreditAttribution: theactiveme commentedI updated CCK today and had the same problem as well. spent all day yesterday uploading images to nodes, and now they are all gone! The files for images are still in the file folder, but the nodes don't seem to show them. however if I go into edit mode it still shows me thumbnail that something was uploaded
Comment #3
KarenS CreditAttribution: KarenS commentedI think this is because the widget got renamed from 'imagefield' in the D5 version to 'imagefield_widget' in the D6 version. The upgrades do not rename fields to use the new widget name, so they are 'lost' (still in the database but not showing up in the field).
I think you either need an update to rename the widget in content_field_instance to match the new definition, or change hook_widget_info() definition to use the original name.
There are other updates that are manipulating widgets with the original name, none of the updates seem to refer to the new widget name.
Plus after all the renaming, you'll need to run content_associate_fields('imagefield') because with the widget name change the database fields would not have gotten updated. You can see an example of this in text.install since the text module renamed a widget.
So the main question is whether you want to use the new widget name or the old widget name, then we can update accordingly.
Comment #4
KarenS CreditAttribution: KarenS commentedActually this is a bug report, and critical, because it makes upgraded fields unusable.
Comment #5
KarenS CreditAttribution: KarenS commentedLooking at this more, I see there is an update that is trying to rename the widget to 'imagefield_widget_default', but there are a couple problems with that. First, that still doesn't match the widget name in hook_widget_info().
Second, it isn't necessarily getting triggered at all because you use content_fields() to interate through the fields and it isn't safe to use that in the install file any more because in D6 *all* updates get run, even when modules are disabled. So if you have the imagefield code in the modules folder but haven't enabled this module yet (like if you're enabling one module at a time to be sure everything is working), the imagefield info will not be in content_fields() and that update is marked as completed without anything actually happening.
CCK updates in D6 have been a nightmare because we can't use any of the content functions safely since not all modules are necessarily enabled, so we created the content_types_install() function (in content.install) as a 'safe' way of getting field info in install files. So you'll need to use that in the install file. For the same reason, I'm not sure content_field_instance_update() will work reliably in the install file, you may have to manually update the database to be sure it works right.
I'm still confused about what name you actually want to use as the widget type, though.
Comment #6
KarenS CreditAttribution: KarenS commentedPlus you need to add the test to be sure that the Content module update 6000 has run before you do anything else or the code will be trying to update database columns that don't exist yet.
Comment #7
KarenS CreditAttribution: KarenS commentedI take it back, you can't use content_types_install() for this purpose because that won't find disabled modules and you need an update even when disabled.
Actually, the easiest fix might be to add a test whether the module is enabled and if not just #abort. Then you could safely use the regular functions to do the update.
Comment #8
webernet CreditAttribution: webernet commentedRelated: #286474: D5 to D6 Update path
Comment #9
KarenS CreditAttribution: KarenS commentedBump. This is critical because anyone who has imagefield modules in the CCK folder during their upgrade ends up with a screwed up database.
Comment #10
KarenS CreditAttribution: KarenS commentedSee http://drupal.org/node/304813#comment-1025832 for the latest recommendations for updates of CCK modules.
Comment #11
Zach Harkey CreditAttribution: Zach Harkey commentedAfter carefully following the latest upgrade procedures (from the CCK project page) I was able to successfully preserve all of my Imagefield 5.x images.
The images did not show up until, for each content type & imagefield I went into the administrative settings and reset all of the filepaths which were blank after the update. (This was not straightforward either, I had too click the "Change basic information" button and then submit the following form, just to get the path fieldset to even display at all, when it did display, the previous paths were wiped.)
I also had to wipe my imagecache presets and rebuild them.
After these steps, the images appear correctly everywhere.... except the admin edit form where the imagefield upload widgets show up missing their thumbnails.
As far as I can tell, Imagefield 6.x-x creates its own independent thumbnails now, (in the past it would just optically scale down the originals). The new thumbnails are created in the same directory as the original :/ and have 'thumb.jpg' appended to the filename.
http://example.com/sites/example.com/files/images/my-image.jpg.thumb.jpg
Newly uploaded images get the new thumbnails upon upload. All the images previously created with Imagefield 5.x do not have these thumbnails, but the admin form looks for them anyway.
Comment #12
douggreen CreditAttribution: douggreen commentedI was able to get the widget update to work after much finesse. The trick for me was to set the widget_active flag to 1 in {content_node_field_instance}, for widgets of type "image", delete the field, recreate the field, the recreate failed, but then recreate it again, and then all the existing images were magically there!
Comment #13
bjaspan CreditAttribution: bjaspan commentedI may have found the bugs that make imagefields not upgrade properly, but I'm not 100% confident my fix is correct. Patch attached, with explanatory comments.
Comment #14
catchLast time I checked this bug was still valid, so bumping version. I'll do my best to review this and test it on a real D5 site tomorrow.
Comment #15
mecano CreditAttribution: mecano commentedsubscribing
Comment #16
smougel CreditAttribution: smougel commentedI'm a drupal newbie and I have the same problem : http://drupal.org/node/332692
Maybe, it will be usefull to explain this problem to CCK users who are upgrading from CCK 6.x-2.0-rc10 to CCK 6.x 2.0 with a text in red on the CCK module download page !
Comment #17
marcvangend@bjaspan, #13:
Thanks for this patch. I only read this issue after I had unsuccessfully tried to upgrade, and my imagefields didn't work anymore. I took these two lines from the patch:
and run them in the execute-php-block from the devel module. Now my image fields are back in business again. I only have an error message left in Views, but I believe this is not related.
Comment #18
tanoshimi CreditAttribution: tanoshimi commentedThe solution described in +17 (mostly) worked for me, so thanks for that! I still had to go in and out of every content type to resave the widget, but after that it worked.
Comment #19
allella CreditAttribution: allella commented#17 did the trick for me. Kudos
Drupal 5.12 to 6.6, CCK 2.1, Imagefield 6.x-3.0-alpha2
Comment #20
catchTested this on a site with two imagefields (and several thousand instances), was originally a 4.7 site. Since it's been verified to work by a few people now, bumping to rtbc
Comment #21
capellicThanks guys. I definitely had to clear my cache after running the PHP code, but I didn't have to save the content types.
But then I noticed that I was having problems with a filefield field type. I dug through my database, looking at content_node_field and content_node_field_instance and noticed that "active" was set to 0. I changed the value to 1 and then reset my cache and it worked.
Comment #22
guillaume.outters CreditAttribution: guillaume.outters commentedI have an alternate patch in #336259: Imagefield widget upgrades aren't working (more complete patch) that solves #11, #18 and #21. However, your #5, Karen, makes me think my patch still needs a bit work before being fully upgradeproof.
Comment #23
catchguillaume, I've marked the newer issue as duplicate #336259: Imagefield widget upgrades aren't working (more complete patch) - please re-attach your patch to this issue so things can be tracked in one place.
Comment #24
guillaume.outters CreditAttribution: guillaume.outters commentedOK, here we go.
First, big warning: as of 11/19, this patch is not the RTBC one. See #13 and #17 for this matter.
Now my new patch:
+ preserves storage base path "filepath" (imagefield will find images, where you stored them on D5)
+ creates full imagefield_widget (no need to reedit them)
+ calls what should reactivate the widget once the update went well
- heavily relies on CCK being there. Some conservative tests should be made before each function, to test for its capability to answer as intended.
- relies on imagefield_widget form being able to create forms (to get default values). It worked on my site, but I suspect multiple tries to update resulted in my database being in a not-so-pure-5.x-without-any-update state. Thus perhaps when someone tries to run the update on a really fresh 5.x install, the form will be empty (or crashy); I don't know the Drupal upgrade process enough to tell if forms are able to generate as soon as imagefield.install is running.
Comment #25
guillaume.outters CreditAttribution: guillaume.outters commented(hmm, so previewing made the attachment disappear. Good to know)
Comment #26
bjaspan CreditAttribution: bjaspan commentedSo. Based on guillaume's patch in #25 and another look at the code and my own patch (#13), I am now not confident that my patch is right (even though it seems to work). I also think guillaume's patch is wrong, and also that the current code in imagefield.install is seriously borked. I'm setting this issue back to CNW.
Details:
1. My patch is wrong because it just whacks all 'image' widget names to be 'imagefield_widget' and re-associates fields. This makes content_fields() return all the image fields so be updated. This does seem to work, but see point 3 below.
2. guillaume's patch adds update_6002() which does some work to change 'image' widget settings into 'imagefield_widget' settings. It looks to like that those steps are already handled in update_6001() *if* my patch is applied, so maybe he wrote his patch to work based on 6001's current behavior (which is "do nothing" without my patch) and so ended up duplicating the code.
3. I also noticed that update_6001() attempts to use the batch API to run the functions _imagefield_update_6102_move_operation() and _imagefield_update_6102_drop_operation(). However, those functions do not exist, though _imagefield_update_6001_move_operation() and _imagefield_update_6001_drop_operation(). Thus, I think these functions are never getting called. Someone (dopry?) bothered to write them so I figure they are probably doing something important, though I haven't taken the time to figure it out.
dopry gave me permission to commit my reviewed patch in #13, but given item 3 above and the differences in guillaume's patch I suspect what I would end up committing is different enough from #13 that it would need another review first. For today, I'm punting.
Comment #27
guillaume.outters CreditAttribution: guillaume.outters commentedYou're right, 6001 already had the code. I hadn't even looked at it.
My code added some widget fields based on the forms gathered in current filefield and imagefield (takes the default values provided by those forms, that ensures converted images have all imagefield_widget fields). It then completes with whatever fields it finds in the old image widget, and renames some fields (image_path to file_path). Then it writes back the whole modified thing to DB. I think this "fill the form" mechanism could be integrated in the actual patch (before computing 'multiple', which I had not ported, and changing 'image_path' to 'file_path', which I had).
For the content_fields(), that your patch has to fool: couldn't it be replaced by what I use in my patch:
content_field_instance_read(array('widget_type' => 'image'), TRUE)
as of D6.6, when I tried it, it has the same return type as content_fields, that is, fields with a ['widget'] in it, so it seems safer and still compatible.
Regarding imagefield_widget_default: why not imagefield_widget?
Comment #28
cgjohnson CreditAttribution: cgjohnson commentedThanks for all who patched and shared -- any final updates? I am having this prob after upgrade to D6 from 5. Thanks.
Comment #29
szy CreditAttribution: szy commentedHi there,
What are plans for this module?
This one module makes upgrade from D5 pointless:
- with the patches above there is no edit preview, custom alt and title fields are empty,
- without them - I'm losing hundreds of pictures from D5.
Please let us know, please help us :]
... and thank you for your work... :]
Szy.
Comment #30
Zach Harkey CreditAttribution: Zach Harkey commentedAnyone who has upgraded to Drupal 6 only to find that your imagefield admin thumbnails are not working, add the following function to your theme's template.php file.
It will basically tell the form to use the actual file instead of the lame .thumb.jpg. This is exactly how it was handled in D5, and IMO should still be this way. Anyway. No patches, no hacks, portable, gets the job done, welcome to D6.
Note: The
width="150"
is only there to keep the image from taking over the form. It can be safely removed in favor of declaring a width on img.imagefield-admin-thumb in your stylesheet.Comment #31
OFF CreditAttribution: OFF commentedthis is not work for me
i try
imagefield-6.x-3.0-alpha1
and
imagefield-6.x-3.0-alpha2
file is exist and displaying on the node page, but lame thumb file not displaying!
help!
Comment #32
Damien Tournoud CreditAttribution: Damien Tournoud commentedThis is the first working update path I know of.
The update process is in two parts:
1. Update the widget definition
- first change the name of the widget from 'image' to 'imagefield_widget'
- run content_associate_fields('imagefield')
- then, for each field instance:
- migrate 'max_number_images' to 'multiple' (was severely broken, fixed it)
- update formatter name
- call content_field_instance_update($field);
2. Migrate the old schema to the new one (batch operation)
- for each field (not field instance)
- for each row in that field
- migrate 'title' and 'alt' to 'data'
- create the thumbnail
Comment #33
webernet CreditAttribution: webernet commentedAfter a quick test, this appears to be working. Rerolled to fix a broken 'case' statement -- the 'default' case must always go last.
Needs further testing/review.
Comment #34
Damien Tournoud CreditAttribution: Damien Tournoud commentedEither there is a mistake here, and this should be
default:
instead ofcase 'default':
, or it's just testing for a string value of 'default', and I don't see why that test should be last.Comment #35
webernet CreditAttribution: webernet commentedYou're right -- I was thinking it was simply "
default:
".I assumed that was the problem since the original display settings still aren't migrating fully. Images with display values of 'Default' end up set to 'Generic files' rather than 'Image'.
I guess it should either be "
default:
" or "case 'imagefield_default':
"Comment #36
pedropablo CreditAttribution: pedropablo commentedGreat!! I have also tested this patch and it has repaired by completely broken db regarding imagefield (well, after my many tests and changes with the original imagefield.install, so it was not strange the db ended broken.. :-)). But just removing unneeded columns added to node types tables (?¿) and just restoring the previous (5.x) imagefield table did the magic...
This version of the file is much, much better, and I think it accomplishes what autor's module was trying to do when he started to write the update functions... So thank you very much for your work, Damien!!
Comment #37
drewish CreditAttribution: drewish commentedpedropablo's review aside it seems like the 'default' at least needs some work.
Comment #38
jeeves CreditAttribution: jeeves commentedThis is going to be pretty detailed, but I want to be sure I used the right workflow for implementing this fix. Unfortunately, the patch did not work for me.
Here is my workflow. Note I recently upgrade to Drupal 6, being carefull to follow the recommendations for upgrading CCK:
update.php
The selected version for the imagefield module was 6002After the upgrade, I still had not restored the imagefield images that were on my blog, and I was getting the following message in my blog content type (see attached screenshot)
Comment #39
bwynants CreditAttribution: bwynants commentedworked for me!
Comment #40
nicholas_w CreditAttribution: nicholas_w commentedI just tried this with the most recent patch, and it got my images moved over. The formatter was not properly set for image_plain, but that was easily solved by resaving my display settings. I tried the update with both versions of the default switch from above and neither worked, and because I'm using imagecache for everything but one default display, I really can't tell if any of the formatter translations are working. But it did get the site working.
Comment #41
jeeves CreditAttribution: jeeves commentedPerhaps I had no success because I patched the wrong version (athought the patch applied just fine to the Dec. 15, 6.x-3.x-dev version).
Would anyone who has had success with this, please post weather they used "webernet" version or Damiens version of this patch?
And exactly what version of the module was the patch applied to?
Comment #42
bwynants CreditAttribution: bwynants commentedI used version from comment #33 on version 1.16 of install file
Comment #43
jeeves CreditAttribution: jeeves commentedThank you for the clarification on the versions. I repeated the process of updating but I am still not getting the images. And I get the following message on the "Manage fields" page of the content type:
Perhaps it is not working because I am missing a step?:
Any important steps left out?
Comment #44
webernet CreditAttribution: webernet commentedRevised patch:
-It looks like it should be [format] not [formatter]
-Uses 'imagefield_default' rather than 'default'
@jeeves - Imagefield 6.x is currently alpha quality - that means 'use at your own risk'. You might be able to get your fields properly migrated by running imagefield updates starting with 6001, but there are no guarantees.
Comment #45
jeeves CreditAttribution: jeeves commentedSuccess with webernet's patch at comment #44!
Thanks for the new patch webernet - the changes you had just made seem to have made the difference for my Drupal install. I had installed earlier versions of the patch with no success. Now everything works, and I did not even need to jigger or reset the imagefield settings.
So the upgrade procedure that worked for me was:
Comment #46
catchBack to CNR, looks like a cross-post.
Comment #47
frjo CreditAttribution: frjo commentedTested webernet's patch #44 with imagefield 6.x-3.x-dev and everything seems to work as it should on my local dev enviroment.
The existing images displays according to the fields settings and on the edit page I get the thumbnails. Creating new nodes with images also works.
My procedure:
* Install Drupal 6 and all modules I need, but *not* any contributet CCK field modules.
* Ran update.php on my Drupal 5 databas.
* Installed CCK field module including imagefield.
* Ran update.php again.
Thanks everyone for working on this. The imagefield is the one thing holding up a move to Drupal 6 for me now.
Comment #48
nicholas_w CreditAttribution: nicholas_w commentedI upgraded another site, using the Dec-14 dev release of imagefield and the #44 patch, and everything seems to have worked brilliantly! I don't even have to resave the types' display settings...
This was the big thing holding me back too, so thanks everyone.
N.
Comment #49
peterjlord CreditAttribution: peterjlord commentedTested webernet's patch #44 with imagefield 6.x-3.x-dev and everything seems to work as it should on my local dev enviroment. I've a few thousand images and it took a while to run the update.php also came up with a lot of errors containing
Seems to have worked a treat all images working. I can upgrade to 6.x know. Thanks for the great work
Comment #50
Kripsy CreditAttribution: Kripsy commentedI tried this on a live (but offline) site and got the following error:
An error occurred. http://www.mysite.net/update.php?id=42&op=do <br /> <b>Fatal error</b>: Allowed memory size of 67108864 bytes exhausted (tried to allocate 10848 bytes) in <b>/home/projectu/public_html/includes/image.gd.inc</b> on line <b>190</b><br />
I assume that means I need to enlarge the php memory value, I'll try that out but if this patch does get committed someone should make a note about this.
Comment #51
Kripsy CreditAttribution: Kripsy commentedInterestingly it seems despite giving me that fatal error, everything is now fixed. I still can't get Lightbox 2 to work properly with thumbnails but I don't think that is a related issue.
Comment #52
vordude CreditAttribution: vordude commentedRan the patch in #44 against imagefield.install,v 1.16 2008/11/07 with success.
My ImageFields now exist in D6.
I incorporated the patched ImageField Module as a part of the upgrade process.
Upgraded Drupal.
Upgraded CCK.
Installed FileField.
Upgraded ImageField.
Upgraded the rest of my modules.
(running the update.php after each step)
(for an ubercart site, (the standard "product" cck content type)
Comment #53
parrottvision CreditAttribution: parrottvision commentedI did things a little backwards and had to backtrack.
First I install 6.x-3.0-alpha2
Then I had the imagefield issue with it saying "is an inactive Image field that uses a image widget"
So then I upgraded to 6.x-3.x-dev but still no luck.
Then I patched the imagefield.install file with #44 (please note upgrade imagefield.install not imagefield.module)
I ran update.php and it ran 6002 update for imagefield but still no love... :(
THEN I re-ran the update for 6001 on the imagefield module and it re-ran updates 6001 and 6002. It took a while to process the update but it worked!!!
So hopefully that helps someone.
Comment #54
introfini CreditAttribution: introfini commentedI've also tested webernet's patch #44 and all went well.
Thanks a lot, this was holding all my upgrades to D6.
introfini
Comment #55
drewish CreditAttribution: drewish commentedi didn't test this but between eyeballing it and it looking good and the positive feedback i went ahead and committed it. it's definitely better than what's there.
so thank you very much to everyone who helped writing and testing the fix.
Comment #56
basicmagic.net CreditAttribution: basicmagic.net commentedhi and thanks for such a great mod.
just fyi-
i updated to the latest version-
6.x-3.x-dev 2008-Dec-30
and got some errors, on running the DB update.
specifically-
i had installed imagefield 6.x-3.x-dev from start on drupal 6.8.0
no issues
so i was not upgrading or anything
but the 6002 update was trying to drop the existing columns
for the existing TITLE and ALT fields
for each cck image field
the update didn't seem to let the drops go thru-
but the errors were reported
does this mean anything to you
please advise and thanks again
v
Comment #57
adam640kb CreditAttribution: adam640kb commentedI am getting the same errors while upgrading to alpha3 RE: #56
Comment #58
fractile81 CreditAttribution: fractile81 commentedI'm still having the problem with update 6002. I try to run it, it just hangs there not doing much of anything until it errors out. I get a bunch of errors saying it can't drop certain columns, but that may be because I've run it more than once and it's trying to start from the beginning. But the end result is that update 6002 doesn't complete according to update.php.
Comment #60
alexmoreno CreditAttribution: alexmoreno commentedi upgraded from drupal 5 to drupal 6 and suddenly my images dissapeared. I re-run update selecting 6001 for imagefield and the appeard again "automagically".
Thanks a lot.
Comment #61
afagioliSee http://drupal.org/node/327041#comment-5217206