Closed (fixed)
Project:
Imagecache External
Version:
6.x-2.0-beta2
Component:
Miscellaneous
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
12 Sep 2011 at 17:17 UTC
Updated:
6 Feb 2013 at 22:36 UTC
Hello,
is there a way to use this module together with views?
I have a situation like this:
In a cck Link field i save a url to an external image.
with Views i want to show this image, embeded in a link ( via rewrite output) and the image should be resized by imagecache.
I could not find a way to do this using the 2.0 Version of this module.
Am I overseeing something, or is the support for views missing?
Comments
Comment #1
larowlanYou can
a) create a new formatter for the url field (either in code or using custom formatters module).
b) you can use views custom field project to create php based fields.
LR
Comment #3
jaydxb commentedHello,
Thanks for this module.
This is what exactly I am looking for. However, I am not able to utilise it still.
I am using views, D6. Would like to rewrite the field [field_img_data_value], which contains an external url, to show the image.
Installed Views Custom Field to render php.
Where do I use
and
print $image_url;" alt="image description" />
I can't see a folder (external) created under the site>files
In the above code, where is $url, $preset defined?
Thanks for any help.
Jay
Comment #4
drshearer commentedI came up with a solution that works with the D7 version of this module. You'll also need the Views PHP module (http://drupal.org/project/views_php) to create a global PHP field in your view. In the Output Code section of that field, add the following code:
In this case, I'm using a text field for my external image URL with field name 'field_image_embed'. My desired imagecache preset is this case is called 'thumbnail'. Change these values to your own field name and imagecache preset, and voilà - your view should display an imagecache version of the external image.
I have not tried this in D6, but I imagine the same idea could work, using the Views Custom Field module (http://drupal.org/project/views_customfield) and the D6 version of the implementation code for Imagecache External.
Comment #5
stevenmhouse commentedWhile the above will work, what I'd suggest instead is using a template file in your theme's template folder for the view field. My file name is: views-view-field--field-description.tpl. You need to go to views - theme (or similar) and look for the field that you want to use external imagecache on, and click on that to get the template (only print $output). After you create and save the file in the right place, click on Rescan button in views to have it locate that file (the file name will become bold).
The advantages for sites w/ traffic: views_php stores php in the DB. This means a db request happens, then processing of the php, which takes longer. If done this suggested way, there isn't the overhead associated with the db load.
Here's my code, with the origonal line commented out.
Comment #6
jonmcl commentedI submitted a patch that adds a field formatter. This might solve this issue without having to use custom PHP.
#1910160: Add Imagecache External Image field formatter