Filefield, Views and Services : File Path does not show up

kone23 - July 2, 2009 - 16:15
Project:FileField
Version:6.x-3.0
Component:Code
Category:support request
Priority:normal
Assigned:Unassigned
Status:closed
Description

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

#1

kone23 - July 2, 2009 - 16:16
Title:Filefield, Views and Services» Filefield, Views and Services : File Path does not show up

#2

quicksketch - July 3, 2009 - 02:28

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.

#3

quicksketch - July 3, 2009 - 02:29
Category:bug report» support request

#4

kone23 - July 4, 2009 - 07:48

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 ?

Thanks

#5

quicksketch - July 4, 2009 - 07:51

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.

#6

kone23 - July 4, 2009 - 08:11

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

#7

quicksketch - July 4, 2009 - 08:59
Version:6.x-3.0-beta1» 6.x-3.0
Status:active» fixed

Great, glad I could help.

#8

possum4all - July 14, 2009 - 03:48

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

#9

System Message - July 28, 2009 - 03:50
Status:fixed» closed

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

#10

CHEETAH - October 13, 2009 - 18:01

Indeed, 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

#11

CHEETAH - October 13, 2009 - 18:03
Status:closed» active

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

#12

quicksketch - October 13, 2009 - 18:57
Status:active» closed

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.

#13

merrick.christensen - November 10, 2009 - 17:40

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

 
 

Drupal is a registered trademark of Dries Buytaert.