2

I'm in Drupal 6/views 2 and am rewriting the output of an image field. Is there a way to fetch the filepath of the image for the output? I have tried the filepath token for the image field, but the src for the image is not rendering, just the argument. Should I be using a preprocessor hook in a template file to do this instead?

1

One trick I like to use is adding a field that contains the value I need, then hiding it from display but using it's token value for your original field's override.

So your view fields would look something like:

image path (hidden from display)
image (using value from the above field)

Keep in mind that the order is important here, so you only have access to tokens that are above the field you want to use them in.

You may need to tweak the settings of the path field to make it the style of url you need (relative, absolute, etc).

|improve this answer|||||
  • Thanks. From within my view config page, I don't have an image path field that can be added. Only Node:Path comes close. Would a module make the filepath accessible? – edroms Jul 11 '12 at 19:55
  • You'll need to add the file relationship to the view to see the extra file fields. Mine was called Content: image (field_image) - fid for reference. – Mark Ferree Jul 12 '12 at 18:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.