Closed (fixed)
Project:
Content Construction Kit (CCK)
Version:
6.x-1.x-dev
Component:
General
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
7 Jun 2006 at 11:41 UTC
Updated:
11 Nov 2006 at 13:45 UTC
I would be grateful if someone could tell me how to do this:
I'm currently trying:
<center><img src="<?php print $node->field_member_picture['view']; ?>" /></center><br/>
and
<center><img src="<?php print $node->field_member_picture['view']->filepath; ?>" /></center><br/>
but neither of these display the image. I'm sure the answer is straightforward but I really need some help on this because the imagefield becomes useless for me (on this particular site) otherwise.
Regards
Patrick
Comments
Comment #1
David Lesieur commentedTry this (untested):
This should generate the required <img> tag.
BTW, I would not recommend using <center>, as it is not supported in XHTML strict.
Comment #2
Patrick Nelson commentedDavid,
Superb! Thanks for that - only one question left... how do I control the size of the image that is displayed? I want to allow people to upload in any size, but for the display in this instance I want to control the width...
Regards
Patrick
Comment #3
David Lesieur commentedHaving imagefield resize images is still being discussed. But if it is acceptable on your site, you could set the display size in the img's attributes.
For example (again, untested!):
With more PHP magic, you could preserve the image's aspect ratio. You will need getimagesize().
And in the following example aspect ratio is preserved, but you do not really control the size:
Comment #4
Patrick Nelson commentedThanks David, but that's not working. The image attributes seem to be already been fed in from somewhere. When I look at the source code on the page, this is what I see:
The 50%'s are mine, but, as you can see, they're been superceded by the width and height figures before them. Any idea how I could get rid of them?
Regards
Patrick
Comment #5
Patrick Nelson commentedI found the answer. The line I've used that works is:
Many thanks for all your help, David.
Comment #6
karens commentedMarking fixed. See http://drupal.org/project/imagefield project for more info and current version.
Comment #7
(not verified) commented