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:"";

How could I get what I really need ?

Thank you in advance


kone23’s picture

Title: Filefield, Views and Services » Filefield, Views and Services : File Path does not show up
quicksketch’s picture

FileField 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.

quicksketch’s picture

Category: bug » support
kone23’s picture

Thank 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 ?


quicksketch’s picture

After 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.

kone23’s picture

Thank 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 :)

quicksketch’s picture

Version: 6.x-3.0-beta1 » 6.x-3.0
Status: Active » Fixed

Great, glad I could help.

possum4all’s picture

So, simple. Glad kone23 asked the question. Very helpful... thanks quicksketch.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

CHEETAH’s picture

Indeed, this is helpful.
many thanks.

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

CHEETAH’s picture

Status: Closed (fixed) » Active

I think this should be re-opened for the reasons stated above:
Imagecached images are still not accessible from the Services module..

quicksketch’s picture

Status: Active » Closed (fixed)

Imagecached images are still not accessible from the Services module..

That's an issue for the ImageCache module, not FileField. You should open a separate issue in that queue and reference this one.

merrick.christensen’s picture

Thank you so, so, so much for this solution. I was going crazy!

manuelBS’s picture

Can anybody tell me the link to the issue that handles the request for service integration of the image cache module?

beauz’s picture

Has anyone solved this? I need imagecache absolute paths output through the services module too...