![Announcement icon Announcement icon](https://www.drupal.org/files/styles/grid-2-2x-square/public/announcements/drupal-evergreen-logo-280X280px%20%281%29_0.jpg?itok=PHpn6rCb)
I am facing a problem when creating a view including an filefield path :
I created a view in order to send recent nodes infos to flash via services and amfphp or via an XML file.
I need the "raw output" to be set as "fields", for I want to access the path of an image thumbnail created with imagecache.
Note that even with the generic file, not coming from imagecache, the bug remains.
The preview works just fine, displaying the right URL or path, so for instance:
sites/default/files/images/Image 1.png
But when I look either at an XML or at what "views.get" receives through "Services", instead of receiving a valid file path for my image field, I have this :
[node_data_field_headline_image_field_headline_image_fid] => 94
[node_data_field_headline_image_field_headline_image_list] => 1
[node_data_field_headline_image_field_headline_image_data] => a:11:{s:11:"description";s:0:"";s:3:"alt";s:0:"";
s:5:"title";s:0:"";s:8:"duration";i:0;s:6:"height";i:400;s:5:"width";i:520;s:18:"audio_bitrate_mode";s:0:"";
s:18:"audio_channel_mode";s:0:"";s:12:"audio_format";s:0:"";s:13:"audio_bitrate";i:0;s:17:"audio_sample_rate";i:0;}
How could I get what I really need ?
Thank you in advance
Comments
Comment #1
kone23 CreditAttribution: kone23 commentedComment #2
quicksketchFileField only stores a File FID (file ID) in it's own tables. What you need is the File data itself, which contains things like the file path. Add a relationship in your view based on the file field, then you'll be able to add fields like "File: filepath" to your list of fields.
Comment #3
quicksketchComment #4
kone23 CreditAttribution: kone23 commentedThank you for your answer.
I tried what you suggested, adding a relationship in my view, it did not change anything.
In fact, Views displays the filepath in its preview.
It is only once the view goes to Services that the filepath disappears and indeed, just the fileID is given.
Is there a way to get the filepath through Services ? So that views.get would send me back what I need ?
Thanks
Comment #5
quicksketchAfter you added the relationship, did you add a "File: Filepath" field? FileField creates the link to the file by using a second query when it is displayed to the user. Since this is done in the display handler, Services does not get this information, which is why you need to add "File: Filepath" manually for Services to get it.
Comment #6
kone23 CreditAttribution: kone23 commentedThank you so much Quicksketch for your fast answer !!!
My mistake, in your first answer I misread "file" and thought you were talking about "content", that's why I did not get what you wrote and why it did not work.
Now IT DOES WORKS perfectly !!! and I get the filepath through services. Awesome.
I have been struggling with that for the last 2 weeks. Many other people are looking for that as well accross the forums and issue queues. I will redirect them to this thread.
Thank you again, you really saved my deadline :)
Comment #7
quicksketchGreat, glad I could help.
Comment #8
possum4all CreditAttribution: possum4all commentedSo, simple. Glad kone23 asked the question. Very helpful... thanks quicksketch.
Comment #10
CHEETAH CreditAttribution: CHEETAH commentedIndeed, this is helpful.
many thanks.
...but
This solution eliminates the functionality of Imagecache.
Yes, the orginal filepath becomes visible with Services, but the imagecached versions are still not accessible.
I'm trying to figure out a work-around..
It may involve constructing an item-renderer on the front end of my (Flex) application that can accomodate this
Comment #11
CHEETAH CreditAttribution: CHEETAH commented^
I think this should be re-opened for the reasons stated above:
Imagecached images are still not accessible from the Services module..
Comment #12
quicksketchThat's an issue for the ImageCache module, not FileField. You should open a separate issue in that queue and reference this one.
Comment #13
merrick.christensen CreditAttribution: merrick.christensen commentedThank you so, so, so much for this solution. I was going crazy!
Comment #14
manuelBS CreditAttribution: manuelBS commentedCan anybody tell me the link to the issue that handles the request for service integration of the image cache module?
Comment #15
beauz CreditAttribution: beauz commentedHas anyone solved this? I need imagecache absolute paths output through the services module too...