I'm trying to theme image nodes using the Aberdeen theme. Currently the node image is output after the node body text - I'd like to make the image appear first, or alongside the body text. How can I do this?
I'm trying to theme image nodes using the Aberdeen theme. Currently the node image is output after the node body text - I'd like to make the image appear first, or alongside the body text. How can I do this?
Comments
Comment #1
nwe_44 commentedyou need to duplicate the node.tpl.php and rename it node-image.tpl.php. this new file is where you can theme the appearance of your image nodes. The code you want in there will look something like
Comment #2
underpressure commentedHow would you add a custom style sheet to the node.image.tpl.php???
Comment #3
tvaughan commentedMany thanks for the reply - after a LOT of Googling I managed to get to this in my node-image.tpl.php:
print $node->content['image']['#value'];print $node->content['body']['#value'];My next problem is how to make the displayed image a different size (i.e. display the thumbnail in the node body)
Comment #4
nwe_44 commentedperhaps it would be easier to use the image modules own api rather than burrowing through the array yourself as that will give you better future proofing.
try
or if you want it to be a link you could use something like
to add a custom stylesheet to the template add something like
or whatever the route to your file is.
Hope this helps.
Comment #5
nwe_44 commentedSorry, my last post had a slight friday style logic to it.
It might have been more easily understandable if I wrote
Comment #6
tvaughan commentedReally helpful, thanks!
Comment #7
drewish commentedComment #8
sprugman commentedI need to find the size of my images (in pixels). I'm using the image module, and have created several sizes in the admin. It's happily generating images for me, but I can't figure out how to tell what the actual generated size is.
I've got $node->iid, so I could probably use that to search the db, find the filepath, and use getimagesize. Yuck.
I've also got $node->content[image_attach], so I could search that string for the information. Also yuck.
Presumably, there's some simple function I'm supposed to call, or something, right? Please?
TIA
Comment #9
sprugman commentedI need to find the size of my images (in pixels). I'm using the image module, and have created several sizes in the admin. It's happily generating images for me, but I can't figure out how to tell what the actual generated size is.
I've got $node->iid, so I could probably use that to search the db, find the filepath, and use getimagesize. Yuck.
I've also got $node->content[image_attach], so I could search that string for the information. Also yuck.
Presumably, there's some simple function I'm supposed to call, or something, right? Please?
TIA
Comment #10
drewish commentedhttp://api.drupal.org/api/function/image_get_info/5
Comment #11
sprugman commentedthat's just a wrapper for getimagesize. What I'm really looking for, I guess, is how to find $file, given $node->image_attach_iid
Comment #12
sprugman commentedI figured it out. I thought there would be a method for this, but:
$im = node_load(array('type' => 'image', 'nid' => $n));
from there you can get the file for the desired size, and from there use image_get_info
Comment #13
(not verified) commentedComment #14
intu.cz commentedAnd what did you put into the template.php? Thanks for any info.
Comment #15
lazbay commented