By fighella on
Im looking for some help with imagecache module!
I absolutely love the module. Works wonders for my site, but the problem I am trying to solve is, when the image appears and the "as link" is selected in the view display mode... The link goes to the Node that contains the image... this makes sense, but what I need it to do is link to something different. Anyone have any ideas how I can do this?
For example, the random generated images on the front page, when clicked, link into the "Gallery" page for the specific artist, because that is where the image sits... but.... I need to control the link and make it so it goes to the profile page of the images author...
Any suggestions?
Thanks Jonny
Comments
In most case you should be able to theme the output
In most case you should be able to theme the output, the details though depend on how the output is generated.
theming imagecache output
function theme_imagecache_formatter($field, $item, $formatter) {
if (preg_match('/_linked$/', $formatter)) {
$formatter = preg_replace('/_linked$/', '', $formatter);
$image = theme('imagecache', $formatter, $item['filepath'], $item['alt'], $item['title']);
$output = l($image, 'node/'. $item['nid'], array(), NULL, NULL, FALSE, TRUE);
}
else {
$output = theme('imagecache', $formatter, $item['filepath'], $item['alt'], $item['title']);
}
return $output;
Somewhere in the output I want to make it not node/ --- but user/ (whoever)
JD
Here is the line you want to change
First copy the function theme_imagecache_formatter to your themes template.php file, rename the function phptemplate_imagecache_formatter. Then this line
can be changed to
nevets
and what happens if my theme doesnt use a template.php file?
If your theme uses the
If your theme uses the phptemplate engine you can add a template.php if it does not already have one.
imagecache hack
I just whacked it into the imagecache template and it seemed to work... err is that bad?
It makes upgrading a
It makes upgrading a problem, since upgrading the module would overwrite your changes.
understanding
so im assuming , my install looks for the function in the template.php file first... then in module?
Basically yes
Basically yes
subscribe
subscribe
Drupal samurai for hire, based in Buffalo, New York, USA.
15+ years Drupal, 20+ years web.
http://basicmagic.net