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.
It appears the actual FileField mapper in Feeds module supports Enclosures, but only SimplePie parser uses them. Anyone have an idea how difficult it would be to implement Enclosures in this module? Even just a rough idea to start with would be helpful. Thanks!
elizzle
Comment | File | Size | Author |
---|---|---|---|
#5 | feeds-filefield-description.patch | 1.24 KB | spelcheck |
#2 | feeds-filedescription.patch | 1.27 KB | spelcheck |
#17 | feeds_1080386_17_title_and_alt_fields_and_multiple_files.patch | 1.16 KB | rhouse |
#32 | alt_title01.png | 72.76 KB | dj1999 |
#32 | alt_title02.png | 11.68 KB | dj1999 |
Comments
Comment #1
spelcheck CreditAttribution: spelcheck commentedHonestly, I'm just trying to find a way to import an image URL -> ImageField with an accompanying description.
Comment #2
spelcheck CreditAttribution: spelcheck commentedI was able to do it with a small hack to feeds module, specifically /feeds/mappers/filefield.inc ~ line 45 on latest beta10. It requires you to construct your feed with the file url and description in one field with a pipe delimiter IF you would like a description, otherwise it's business as usual.
EDIT: Use patch from #5.
elizzle
Comment #3
spelcheck CreditAttribution: spelcheck commentedComment #4
spelcheck CreditAttribution: spelcheck commentedComment #5
spelcheck CreditAttribution: spelcheck commentedI didn't need an is_array check, and I was missing a closing bracket. Here is the updated version. ::sigh::
Comment #6
funkeyrandy CreditAttribution: funkeyrandy commentedis there a patch for d7? i need the alt text and description to populate from a csv import
Comment #7
funkeyrandy CreditAttribution: funkeyrandy commentedive ported your code to d7...but what about multiple images? im trying to import like:
image.jpg|1rst image, image2.jpg|2nd image
Comment #8
funkeyrandy CreditAttribution: funkeyrandy commentednever mind....i figured it out....basically jsut exploded my import array by multiple dlimiters for the title and alt fields, and wrote to the $field['und'][$i]['title'] entity
Comment #9
funkeyrandy CreditAttribution: funkeyrandy commentedBasically I just exploded my import array by multiple dlimiters for the title and alt fields, and wrote to the $field['und'][$i]['title'] entity
here is my file.inc modified code....use any delimiters in your file you want ;) someday it would be good to build a delimiter field choice into the field mapper....
my imagefield row in my csv looks like this:
sites/default/files/Montgomery-1.jpg,sites/default/files/Montgomery-2.jpg,sites/default/files/Montgomery-3.jpg|blahblahbl>>blahblah>>blah|at-1*at-2*alt-3
Comment #10
allella CreditAttribution: allella commented@funkeyrandy , is there a syntax for uploading multiple files, via CSV, already built into the feeds file mapper? I know your code above is talking about adding alt and title tags to an image, but I'm just trying to upload multiple files.
I've tried setting the importer delimiter to ; and then using
"filepath1,filepath2"
"filepath1|filepath2"
but the CSV processor returns an error like my CSV has extra columns.
I ask because your example above appears to do comma separated multiple filepaths in one field. It's unclear if that is core functionality for the Feeds module, or another part of your patch.
Thanks
Comment #11
clanghoff CreditAttribution: clanghoff commentedPlease excuse my limited experience in these matters. Sorry if this is the wrong thread, but the issue seems to be tied to this process somehow.
I am trying to upload multiple images via CSV fields. I have implemented the code fix in #9 in this thread with some success. I have been able to upload multiple files into content nodes at times. However, I am randomly getting an error "no active batch" when I run the feed importer. I am stuck at this point, but occasionally something (goodness knows what) changes and I am able to run the importer again. Does anyone here know what the "no active batch" error mean and/or know how to fix it?
Thanks! everyone here has already been so much help with their posts.
Comment #12
funkeyrandy CreditAttribution: funkeyrandy commentedyes..the commas were working by default...i just added pipes to be abe to explode the parts
Comment #13
Dave ReidSupport and feature requests are *never* critical. Please don't abuse the priority field.
Comment #14
dotman CreditAttribution: dotman commentedI get an error like this when I am just trying to get one image and a title:
http://example.org/images/myimage.jpg|this is a title
So does this only work with multiple images? Is the alt required. No error with just the image path, but when i add the pipe and title, I get this:
An AJAX HTTP error occurred. HTTP Result Code: 500 Debugging information follows. Path: /batch?id=86&op=do StatusText: Service unavailable (with message) ResponseText: Recoverable fatal error: Argument 2 passed to token_replace() must be an array, null given, called in /Users/dotman/Sites/sandbox/modules/file/file.field.inc on line 581 and defined in token_replace() (line 79 of /Users/dotman/Sites/sandbox/includes/token.inc).
any ideas? i would like to get at least the title so I might be able to add it as a caption.
Edit: which file.inc file are you adding to, the feeds mapper of the system module? or both?
Comment #15
Dave Reid@dotman: That "Recoverable fatal error: Argument 2 passed to token_replace()" bug has already been fixed in 7.x-1.x-dev.
Comment #16
dotman CreditAttribution: dotman commentedthanks for getting back dave. i'm using the latest version of Feeds 7.x-2.x-dev, and I only get that error when I apply the patch funkyrandy applied to his file.inc mapper shown above.
any idea what in his code would cause that error? It would be nice to map to the title and alt tags. the multiple files isn't as important, but would be cool to have. BTW, thanks for all your and others hard work on this module. it's really appreciated.
Thanks.
Comment #17
rhouse CreditAttribution: rhouse commenteddotman @16, the reason it isn't going is that the latest feeds has some changes not included in funkeyrandy's excellent enhancement. I've done some bulletproofing on funkeyrandy's great work and made it into a patch on feeds-7.x-2.0-alpha4.
I have slightly changed funkeyrandy's syntax to make it a bit simpler:
Example:
Tested, works. Attached.
Comment #18
dimitriseng CreditAttribution: dimitriseng commented@ rhouse. Your solution in #17 looks great. Would you be able to provide the same also for D6 (filefield.inc)? #5 from elizzle is working ok for importing the image description, but it does not import the alt text and title. It also does not handle importing multiple images. Thank you.
Comment #19
TimelessDomain CreditAttribution: TimelessDomain commentedThank you for this rhouse. It works just as you describe.
i was originally thinking ,path/filename1;title1;alt2|path/filename2;title2;alt2, would be better for compiling a bunch of images for quick importing, but after thinking,
use the following rows in your table
- path/filename
- title
- alt
Then each column would be a different image.
after inputting them all -> export a CSV with a ; delimiters then combine the rows in a text program with the | symbol to split them. all good to go for importing@!
excel even has a row-> column flip so that would work here as well if your cells are the normal way (vertical instead of horizontal)
Comment #20
TimelessDomain CreditAttribution: TimelessDomain commentedComment #21
dj1999 CreditAttribution: dj1999 commentedHi,
this is an alternative but this does not handle multiple image fields. This is able to choose whitch csv columns are image alt and title data on processor mapping form.
This is the mappers/file.inc
Regards,
Joe
Comment #22
dimitriseng CreditAttribution: dimitriseng commentedHi, from #18:
Comment #23
rhouse CreditAttribution: rhouse commentedHi Dimitriseng,
Sadly I don't know how! :-( I am more of a Drupal plodder than a Drupal expert.
Comment #24
minneapolisdan CreditAttribution: minneapolisdan commentedThe patch at #17 works for me as well. I'm curious, however, if I also had a field for Documents, and wanted to include multiple values for those as well... Would I need to copy the contents of that patch, modify it for files instead of images, and then apply it too?
Comment #25
Anonymous (not verified) CreditAttribution: Anonymous commentedApplied patch #17 but it only imports the first image of a multiple image field (a gallery) Any thoughts whats wrong? How do you all use this patch?
This is the input for the field:
,"http://devwebsite.nl/sites/devwebsite.nl/files/Products/Kites/devwebsite-img-145-2.jpg|Title of the image|Alt of the image;http://devwebsite.nl/sites/devwebsite.nl/files/Products/Kites/devwebsite-img-145-3.jpg|Title of the image|Alt of the image;http://devwebsite.nl/sites/devwebsite.nl/files/Products/Kites/devwebsite-img-145-4.jpg|Title of the image|Alt of the image;http://devwebsite.nl/sites/devwebsite.nl/files/Products/Kites/devwebsite-img-145-5.jpg|Title of the image|Alt of the image;http://devwebsite.nl/sites/devwebsite.nl/files/Products/Kites/devwebsite-img-145-6.jpg|Title of the image|Alt of the image;http://devwebsite.nl/sites/devwebsite.nl/files/Products/Kites/devwebsite-img-145-7.jpg|Title of the image|Alt of the image",
Comment #26
tonkatuph CreditAttribution: tonkatuph commentedhow do we patch?
Comment #27
rhouse CreditAttribution: rhouse commented@spoetnik, The order my patch works is: All the filenames, all the alts, all the titles. You have file-alt-title, file-alt-title ...
Also try it without quotes around the whole thing.
Ron
Comment #28
chrisjlee CreditAttribution: chrisjlee commented@tonkatuph You'll find your answer here: http://drupal.org/patch
Comment #29
sanguis CreditAttribution: sanguis commentedsubscribing
Comment #30
7wonders CreditAttribution: 7wonders commentedJust found this - http://drupal.org/sandbox/eosrei/1315294 - which means you could just create some dummy fields on your content type to import the alt and title of your choosing to and then let that module do the rest using tokens.
Comment #31
dotman CreditAttribution: dotman commented@dj1999, I just ran your alt and title mapper and mapped a field in my csv to the Image: title and Image:alt, but when I review an article after import, none of those fields are populated. can you confirm this works for you? Is there a character limit on those fields?
thanks.
Comment #32
dj1999 CreditAttribution: dj1999 commented@dotman, yes I can confirm it works fine for me. I did not take any limitations, but I do not know that system make some limitations or not.
Here is some picture from csv, feeds mapper and result.
Comment #33
dotman CreditAttribution: dotman commentedok, it does seem to work. apparently there is a character limit of i think 128 in d7 for title and alt. Have you run into this? i've been following this thread here for patching core to resolve this, as i'm trying to use a caption module that takes the title tag and formats a caption for the image. wondering if you hav any insight into this.
http://drupal.org/node/1015916#comment-5335994
thanks.
Comment #34
febbraro CreditAttribution: febbraro commentedNeeds review, but certainly is not critical.
Comment #35
3CWebDev CreditAttribution: 3CWebDev commentedI have the same issue after applying path #17 only the first image is imported, the others are ignored.
Comment #36
kpv CreditAttribution: kpv commented#17 thanks
Comment #37
maomaohuhu CreditAttribution: maomaohuhu commented#21 worked great for me, thanks ! (applied on top of feeds-7.x-2.0-alpha4 )
NB: I don't think the ending php tag should be there tho.
Comment #38
Summit CreditAttribution: Summit commentedHi, #21 also great for me.
Greetings, Martijn
Comment #39
FiNeX CreditAttribution: FiNeX commentedUsing #21 with Feeds tamper module allows to configure the "Explode" feature in order to import multiple images in the same field.
Example:
The CSV could be something like:
And the Feeds tamper have to be configured on the three fields with the explode filter using the "|" (pipe) char.
Comment #40
chrisjlee CreditAttribution: chrisjlee commentedSo is this going to be rolled into feeds 2.0?
Or is the drupal way eventually going to utilize the aftorementioned synchronize image title sandbox module?
Comment #41
chadmkidner CreditAttribution: chadmkidner commentedI am trying to apply the original mapper concept in #5 for D6 as it appears the rest of the discussion has moved toward D7. I am trying to use it for title and alt though not the description.. I thought this should have been fairly easy as they're all an image sub-field under [data]. I've made small changes hoping to map just the value, title, and alt but the best result I have come up with ONLY imports the image and title but ignores the alt.. Any Ideas??
Heres the complete function with the most recent alterations I've made.
I was able to get this working, I'm updating the code below with what is working for me in D6. Hope it can help anyone else using D6.
Comment #42
1mundus CreditAttribution: 1mundus commentedIs #21 commited in the current dev version for Drupal 7? I use recommended release (alpha5) plus that code and it seems to work perfectly. However, I'd prefer to use it in the official release, since there are thousands of nodes that I have to import and don't want to take a risk that this code breaks something else.
Comment #43
AndyF CreditAttribution: AndyF commentedI've rolled #21 against the latest and included the changes from ea36f8b (the only commit on mappers/file.inc since the snippet was posted). It works for me (including for multiple images if using feeds tamper and explode). Marking as RTBC considering my experience and #39, #38, #37, and #32. I haven't looked through the code myself (I'm a beginner to Feeds development). Thanks!
Comment #44
twistor CreditAttribution: twistor commentedLooks good.
And why do we only check for cardinality == 1? I know that's a common pattern, but it strikes me as odd.
Comment #45
bianchi CreditAttribution: bianchi commentedHello Guys,
Is the separator equal to ":" ?
I saw from :
list($field_name, $sub_field) = explode(':', $target);
I have tried with pipe, and it's not working, I get 404 error from the server.
Line :
"http://lnet-svr-apch/stevesommerfeld/images/stories/clock.jpg<strong>|</strong>http://lnet-svr-apch/stevesommerfeld/images/stories/bike.jpg"
Result :
Download of http://lnet-svr-apch/stevesommerfeld/images/stories/clock.jpg|http://lnet-svr-apch/stevesommerfeld/images/stories/bike.jpg failed with code 404.
Any suggestions guys ?
Comment #46
bianchi CreditAttribution: bianchi commentedIs this the right feed temper ?
Comment #48
bianchi CreditAttribution: bianchi commentedDone with feed tamper,
thanks a lot guys :)
Comment #49
TimelessDomain CreditAttribution: TimelessDomain commentedComment #50
MrPeanut CreditAttribution: MrPeanut commentedFor what it's worth, the code from #21 works for me.
Comment #51
suegmune CreditAttribution: suegmune commentedPlease update this for files with description too! :)
Comment #52
bneil CreditAttribution: bneil commentedThe patch in #43 worked for me.
Comment #53
AlfTheCat CreditAttribution: AlfTheCat commentedHas anyone had any luck with D6? I tried #5 but the patch no longer works. I alo modified filefield.inc to reflect #41 but I see no changes at all (using the latest dev release.)
Using tokens, the alt and title texts are not saved when using feed imports.
Is there no way at all to get alt texts and title texts enclosed when importing nodes from csv with feeds in D6?
Comment #54
chadmkidner CreditAttribution: chadmkidner commented@AlfTheCat Here's a diff file from the actual file I use. Note I use "*" as my deliminator, you can change this to whatever you plan to use in your flat file. For obvious reasons you probably don't want to use a comma unless your file is tabbed.
Comment #55
prakashrajavel CreditAttribution: prakashrajavel commentedComment #56
prakashrajavel CreditAttribution: prakashrajavel commentedthanks its working well
Comment #57
AlfTheCat CreditAttribution: AlfTheCat commented@prakashrajavel, would you be willing to detail more on how you got this to work?
I simply applied the diff patch but I don't get any alt or title desciption destinations in my mapping settings.
Hope you can help me out!
Thanks.
Comment #58
AlfTheCat CreditAttribution: AlfTheCat commentedComment #59
retiredpro CreditAttribution: retiredpro commentedCan we get the patch from #43 re-rolled for the latest dev? I had a Hunk #3 failed error when trying to patch. Thanks!
Comment #60
retiredpro CreditAttribution: retiredpro commentedI was able to get it to work by manually editing my file according to the patch. Import works if I have an image for each row but will error out on rows without any image filenames.
I get the error "SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'fid' cannot be null" and those rows will not import.
Comment #61
AndyF CreditAttribution: AndyF commented@retiredpro
I get that if I leave out the Image: Uri component, but try to import Image: Alt: maybe something's similar in your case?(sorry that's exactly what you've written in your post, it must be too early!) Btw, if you've manually applied to patch, could you reroll an up-to-date one?Comment #62
retiredpro CreditAttribution: retiredpro commented@andy, attached my edits. not sure why, but i try to follow the steps for creating a patch (http://drupal.org/project/feeds/git-instructions) it just subtracts all of the previous code and re-adds my entire file instead of efficiently adding and subtracting the changes.
Also, my errors came from rows that had alt descriptions and no uri values. My bad. Thanks for your help!
Comment #63
lquessenberry CreditAttribution: lquessenberry commentedHey guys! Nice work in the past few months. I am wondering if someone would be willing to give a detailed outline of the versions, patches, and methodologies used to properly import images with Alts and Titles on multiple image instance fields. If someone even maybe has a successfully patched version of feeds that they'd be willing to share, I would appreciate that greatly.
My situation is that I need to be able to map several images with Alts and Titles to one field from a Postgres DB. We tried many of the suggestions above and were short on success, but it seems that you guys are getting it to work. Fortunately, if there is a need to prepare or clean the data and set it up in a certain format prior to mapping it in feeds, we have the ability to mold our data to fit a certain criteria of columns and arrange them to be in a certain format.
I look forward to seeing what you guys come up with, and for those of us having trouble with making patches, or for those of us who aren't great with applying patches, would it hurt to send us a compiled version of feeds with successful patches rolled in? I'd be willing to take one privately as well. If there is anything I can do to help, I will.
Thanks!
Comment #64
AndyF CreditAttribution: AndyF commentedretiredpro wrote:
I haven't checked, but that's probably line endings. Try configuring your editor to use *nix line endings.
lquessenberry wrote:
What happened when you tried to apply the patch from #62? Did it apply? Did the new targets appear?
Comment #65
slefevre1 CreditAttribution: slefevre1 commentedThe patch in #62 did not seem to respect line endings and had wholesale replacements for blocks of code. This patch changes has the same result, but only changes the lines that are different.
Comment #66
lquessenberry CreditAttribution: lquessenberry commentedI am going to try the Patch in 65 and get back with you. What I really need to know is if the patches here will allow multiple Title and Alt values to be stored into a single image field.
Comment #67
lquessenberry CreditAttribution: lquessenberry commentedThe patch in 65 worked for me, but I have not tested it for multiple images yet. I will report back unless someone can tell me that it is working for multiple images in one field.
Comment #68
afeijoI also confirm that Patch #65 works, including for multiple images :D
Thanks a lot, you guys saved my neck. This was driving me crazy.
BTW, I used it with success with a XML source, not CSV.
Comment #69
moonray CreditAttribution: moonray commentedThe patch in #65 breaks the fixes made in http://drupalcode.org/project/feeds.git/commitdiff/9e89fdf
Comment #70
moonray CreditAttribution: moonray commentedAttached patch takes the patch from #65 and re-implements the fixes of above commit.
Comment #71
Elifas CreditAttribution: Elifas commentedOk.. this is all fine and food for the CSV people.. what about me... im using xml to import multiple images from an old CMS and some of the images have captions.... My work around is to have image token field read from a field called
Bellow is the image example of my issue :
first image is the way im currently importing and the highlighted is the alternative way of thinking to get captions from the attribute "alt" in the xml and not from the caption tag which i created a field and hhave mapped....
Myb im missing a small point but my head is now in overdrive!
Comment #72
twistor CreditAttribution: twistor commented#70 is a good start. For one, the patch needs to be created from Feeds root, not the mappers directory.
I have updated some things, to make it more inline with how mappers look today. If I can get a quick review, I'll push it.
Comment #73
moonray CreditAttribution: moonray commentedTesting it out, it turns out the following line returns an object, not a string:
$field[LANGUAGE_NONE][$delta][$sub_field] = $v;
To make it work without throwing notices (and not exceed the 512 field character limit):
$field[LANGUAGE_NONE][$i][$sub_field] = substr($v->getValue(), 0, 512);
Comment #74
Elifas CreditAttribution: Elifas commentedGuys is there an alternative way to patch with out drush??
Comment #75
twistor CreditAttribution: twistor commented#73, can I get more info on your setup? It's possible that it's getting an object, but that's definitely not the normal case.
Comment #76
moonray CreditAttribution: moonray commentedThese are feeds coming in from an RSS feed, so xml format.
Earlier in the function every $v that is not yet an object is turned into one; so yes, we do always get an object:
Comment #77
FreeFox CreditAttribution: FreeFox commentedHi,
I noticed a bug in the patch. Near the end there is a line like this:
This should be:
$field[LANGUAGE_NONE][$delta] .= (array) $file;
Than, when I try the patch #70 I get this error:
SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'fid' cannot be null
After reverting to version alpha7 the image import runs smoothly but without alt & title field ofcourse :(
I tried to find the culprit but my PHP knowledge is not that good to pinpoint the error. I'm available for more detailed info is needed.
Comment #78
asgorobets CreditAttribution: asgorobets commentedHi guys,
According to #77:
It looks like using += is correct here:
Since we want to preserve old fields and merge array values in case some of them already exist. But the error occurred when the array is not initialized.
Adding this would solve the problem:
According to #73:
Not sure why you try to limit the field by 512 chars, but your are right, the $v in our case is always a FeedsEnclosure object, as pointed in #76, it looks like we'll have to move that portion of code in the switch structure under 'uri', because it's useless for 'alt' and 'title' fields.
But for now here is a reroll including mentioned fixes. This should work for those who search for a quick patch to get their work done.
P.S. Tested with multivalued fields and 2 mappings order: URI -> Title -> Alt and Title -> Alt -> URI.
Comment #79
moonray CreditAttribution: moonray commentedFrom what I remember, the alt and/or title field in the DB is limited in number of characters. The DB handler throws notices for longer ones that they got trimmed.
EDIT: To be fair, I only got too long strings when the object got cast to a string and stored in the DB, so I'm not sure if many people will encounter the limit with the bug fixed.
Comment #80
jwmeyerson CreditAttribution: jwmeyerson commentedAfter testing several of the patches and rerolls above - I'm running into what I think must be an oversight on my end.
My feeds mapper now allows for several targets (Image:Uri, Image:Alt, and Image:Title), all of which I attach to the Image source.
My csv uses | to separate the image from the alt and the title, such that fields in my image column within the CSV looks like this:
image/uri/image2.jpg|alttext|titletext
I have Feeds Tamper setup on the Image->Uri, Alt, Title with the Explode plugin and I am using the | delimiter.
I only have one image per node - no need for multiple images, just trying to get alt and title for every image to import.
The importer successfully creates the nodes, but the alt and title sub-fields are filled with the Uri.
So, the outcome is all other sources are successfully mapped, including the image itself (which shows up beautifully) but then the alt and title sub-fields are populated by the uri ant not the actual alttext and titletext values.
Has anyone else experienced this? I've attached screenshots of my setting and my file.inc
EDIT: I got them to work - I just had to create three different sources/csv fields...Image: Uri, Image: Title, and Image: Alt instead of mapping the same source (Image) to three different targets and trying to use tamper->explode plugin to explode the array of targets into the three fields associated with Image.
Comment #82
Summit CreditAttribution: Summit commentedHi,
I would like to get to work with one field filling all three targets: Image: Uri, Image: Title, and Image: Alt instead of mapping the same source (Image) to three different targets and trying to use tamper->explode plugin to explode the array of targets into the three fields associated with Image.
Will this also be possible please?
greetings,
Martijn
Comment #83
redndahead CreditAttribution: redndahead commented#78: feeds-alt_and_title-reroll-1080386-78.patch queued for re-testing.
Comment #85
rajeevkI used #78 & it's working for me .
But when I import data I get some error/warning, it looks like --
What can be the problem ?
Thanks.
Comment #86
twistor CreditAttribution: twistor commentedOk, this should be close to ready.
Comment #87
twistor CreditAttribution: twistor commentedCommitted to 7.x
http://drupalcode.org/project/feeds.git/commit/004f03c
Thanks everybody.
Comment #88
twistor CreditAttribution: twistor commentedComment #89
MegaChriz CreditAttribution: MegaChriz commented@twistor
I think you meant it should be ported to 6.x-1.x. Changing accordingly.
Comment #90
aubjr_drupal CreditAttribution: aubjr_drupal commentedThis isn't fixed and shouldn't be ported to the release version of Feeds yet. I'm using XPath Parser XML.
This feed import was working right before upgrading to the -dev version (was using latest release). I just updated to the latest -dev version to pull in alt/title values as well, and I just ran into the
SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'fid' cannot be null
problem.I'm doing an import of directory people and pulling in images/files. Shortened example of the XML structure:
<person><fullName>John Doe</fullName><imgURL>http://localhost/imgDir/img1.jpg</imgURL>...<moreFields>...</person>
The imgURL XML node is mapped to Picture:URI. The fullName XML node is mapped to Picture:Alt. (I didn't use Picture:Title at all.)
I do see a pattern on which nodes are getting the error. Every person XML node had a fullName value (never empty). Not every imgURL XML node has a value, though. The three person nodes of the 50 that did not have any value in imgURL got the error.
I haven't looked at the patch, but I bet that's the problem - the code isn't checking to be sure there's a URI before assuming there's a place for the alt to go? It wouldn't surprise me if the same problem comes up with a non-empty Picture: Title XML node with an empty Picture: URI XML node.
(Sidenote: When I installed the -dev version, I had to delete the mapping for "Picture" and re-add it as "Picture: URI".)
EDIT: I had planned on using the Picture field using an uploaded default image when no img URL was available in the XML feed.
Comment #91
LeT CreditAttribution: LeT commentedModified file.inc at #9 for importing multiple files with descriptions as well. Works in Drupal 7.
Used the following CSV format:
"path/file1.doc;path/file2.doc | File description 1; File description 2"
The separators I have used are semi-colons in the patch. Make sure files are loaded to server in a temporary folder so "path" is the relative path to the folder where the images/files are located.
Comment #92
Summit CreditAttribution: Summit commentedHi Does this also work with images?
I have problem with this..
Greetings,Martijn
Comment #93
ecksley CreditAttribution: ecksley commentedI am a modestly competent patcher, and this isn't working for me. Something about "can't find file to patch at input line 5." I'm sure it's my fault.
That said, I offer a hack alternative for those who need this feature.
In my case I want my 'alt' and 'title' text to be the same as my 'node title.'
1.) Install rules and write an action like this:
EVENT
-Before Saving content
CONDITION
-Content is Type: Choose your type, this is optional
-Entity has field: Choose your field, this is optional
ELEMENTS
-Execute custom PHP code
-Save Entity
2.) Install Feeds
-Set up and run your import
-your done, rules will map the alt and title fields automatically.
Afterwards you should disable the rule until next time.
If you require more granular control of your 'alt' and 'title' text you could create CCK fields for the feeds import. Then use your rule to match your actual 'alt' and 'title' fields to the ones used in the import. Drop the fields when you done or keep 'em and suppress their display.
I know. It's hack, but it works.
Comment #94
bisscomm CreditAttribution: bisscomm commentedAny update on this?
This error still persists on latest dev version when importing:
SQLSTATE[23000]...
Comment #95
dvl CreditAttribution: dvl commented17: feeds_1080386_17_title_and_alt_fields_and_multiple_files.patch queued for re-testing.
Comment #101
Marc Angles CreditAttribution: Marc Angles commentedI needed to add alt and titles to my imported images.
I was using the last alpha release and I replaced it with the dev version.
I cannot tell if other things are broken but my csv import still works and I have alt and titles to my images now.
Thank you for the effort.
Comment #102
Majk07 CreditAttribution: Majk07 commentedChanges with feeds mdule 2.0-alpha9 and this feeds-alt_and_title-reroll-1080386-86.patch is in the file "feeds_mapper_file.test" row 145:
Old:
foreach ($entities as $i => $entity) {
$this->drupalGet('node/' . $entity->entity_id . '/edit');
$f = new FeedsEnclosure(array_shift($files), NULL);
$this->assertRaw($f->getUrlEncodedValue());
$this->assertRaw("Alt text $i");
$this->assertRaw("Title text $i");
}
}
New:
// Assert: files should be in images/ now.
$files = $this->_testFiles();
$entities = db_select('feeds_item')
->fields('feeds_item', array('entity_id'))
->condition('id', 'node')
->execute();
foreach ($entities as $entity) {
$this->drupalGet('node/' . $entity->entity_id . '/edit');
$this->assertRaw('images/' . rawurlencode(array_shift($files)));
}
Comment #103
MegaChriz CreditAttribution: MegaChriz commentedRestoring issue properties.
@Majk07
This feature is in dev, not in 7.x-2.0-alpha9. 7.x-2.0-alpha9 is a security-only release. This release only contains a security fix on top of 7.x-2.0-alpha8. See also #2508011: Mapping targets for image fields have disappeared.
Comment #104
MegaChriz CreditAttribution: MegaChriz commentedComment #105
abelass CreditAttribution: abelass commentedHi,
is this path finally ported to 7.x ? What are the current solutions for importing the alt field.
Thanks
Rainer
Comment #106
MegaChriz CreditAttribution: MegaChriz commented@abelass
Yes, this feature exists in Feeds since 7.x-2.0-beta1. It isn't available in the Drupal 6 version of Feeds. That's why this issue is still open.
See also this image:
Comment #107
abelass CreditAttribution: abelass commentedHi,
I installed feeds 7.x-2.0-beta1 on a drupal 7.39, title and alt are still not available for the mapping. Se attached image
Comment #108
MegaChriz CreditAttribution: MegaChriz as a volunteer commented@abelass, the "title" and "alt" targets are only available for the field type "Image", which is provided by Drupal core. These targets are not available for other field types, like the field type "Multimedia asset", which is provided by the Media module. If you use the field type "Multimedia asset", create a feature request for the Media Feeds module. If the used field type is provided by an other contrib module (other than the "Media" module), create an issue for that module.
Comment #109
abelass CreditAttribution: abelass commentedok thanks, but actually it is a file, not a multimedia asset. So how should I proceed?
Comment #110
abelass CreditAttribution: abelass commentedHi @MegaChriz ,
I tried the import with a field type "image". I can configure the mappings with the image title and alt fields, but unfortunately the fields aren't imported, do I have to do anything else?
Comment #111
MegaChriz CreditAttribution: MegaChriz as a volunteer commented@abelass Check on the field settings of your image field if you have enabled the "alt" and "title" fields. If that is available, but there are still no values being imported for these fields, you could check if your source is right with Feeds import preview. I developed this module to help with debugging imports. It allows you to see what your source looks like after it has been parsed.
Comment #112
abelass CreditAttribution: abelass commentedAfter some tests I understand better. When I use the Media browser widget that stores the title and alt fields in the tables field_data_field_file_image_title_text and field_data_field_file_image_alt_text - not in field_data_field_image which occurs when the widget file is chosen. How can I make the title and alt import work with the Media Browser widget?
Comment #113
kumkum29 CreditAttribution: kumkum29 commentedHello abelass,
have you found a solution ?
Thanks.
Comment #114
MegaChriz CreditAttribution: MegaChriz as a volunteer commented@abelass, kumkum29
If the Media module causes the alt/title to be saved at a different location, then that issue should be handled in the Media Feeds issue queue. The D7 version of Feeds only deals with fields in the way they are provided by Drupal core (with the exception of the Date and Link fields).
This issue should deal with porting the feature to map to alt/title for an image field provided by the D6 ImageField module to the 6.x-1.x version of Feeds.
Comment #115
abelass CreditAttribution: abelass commented@MegaChriz,
I just opened an issue https://www.drupal.org/node/2666180
But I am not sure if I got you right. My issue is concerning D7 and the image, if I don't understand wrongly is created by the Media.
Comment #116
twistor CreditAttribution: twistor commentedComment #117
Avinash_Barbate CreditAttribution: Avinash_Barbate commentedI have tried the import with a field type "image". I can configure the mappings with the image URL and image title and alt fields, but unfortunately, the title and alt fields aren't imported, do I have to do anything else?