ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Showing height and width in a file field image

September 13, 2011 11:02pm

Subscribe [4]
  • #1 / Sep 13, 2011 11:02pm

    aquaadmin

    64 posts

    I’m trying to display a clickable image on my page but when I look at the generated html there is no height and width parameters? How do I get the ee tag to display this information? How do I add a class and/or id to the image using this tag? Is there a better way to do display a clickable image on a page? This is the code I’m using.

    {exp:channel:entries channel="ads" limit="6" category="791"}
      
    <h2>{taglineAD}</h2>
    <p><a href="http://{linkAD}">{imageAD wrap="image"}</a></p>
    
    <p>{/exp:channel:entries}

  • #2 / Sep 14, 2011 12:33am

    LMO

    203 posts

    You can add a class like this:

    {exp:channel:entries channel="ads" limit="6" category="791"}
      
    <h2>{taglineAD}</h2>
    <p><a href="http://{linkAD}">{imageAD}</a></p>
    
    <p>{/exp:channel:entries}

  • #3 / Sep 14, 2011 3:57am

    John Henry Donovan

    12339 posts

    Did Vim’s advice help aquaadmin?

  • #4 / Sep 14, 2011 12:55pm

    aquaadmin

    64 posts

    He helped me to show the class but how do you get the image height and width?

  • #5 / Sep 14, 2011 1:08pm

    Mark Bowen

    12637 posts

    Hi aquaadmin,

    Currently the File Field tag (which I believe is what you are using here?) only allows you to output the path, filename and extension and what you have above.

    You are welcome to make a Feature Request to add in the height and width variables there too though.

    There is a new 3rd party add-on that just came out which might help you out with this in the meantime though :

    CG FileInfo

    Does that help at all?

    Thanks,

    Mark

  • #6 / Sep 14, 2011 1:19pm

    aquaadmin

    64 posts

    Thanks Mark it does, but I’m not quite sure why those variables would not be included? In the old EE 1.x, when a file was uploaded to the entry, it would place the img src tag into the input box with all the requisite parameters for a semantic html tag. With this new file manager, it doesn’t. Kind of strange since I would think a semantic html file would be a goal of EE 2. Unless of course I’m mistaken and the height and width are no longer needed to be semantic.

    But in any case I’m just having a hard time getting my head around this new file/image management feature. Is using the file field tag the best way to display a user inputted image from the publish panel? The goal is to just let the user include an image that links to an inputted URL.

  • #7 / Sep 14, 2011 1:44pm

    Mark Bowen

    12637 posts

    Hi aquaadmin,

    In the old EE 1.x, when a file was uploaded to the entry, it would place the img src tag into the input box with all the requisite parameters for a semantic html tag.

    I’ve just tested on 2.2.2 and it does indeed still do this although I believe you’re just using a file field here aren’t you?

    Mark

  • #8 / Sep 14, 2011 1:54pm

    aquaadmin

    64 posts

    Yes. I’m using the file field. It makes it much easier for the user to link a photo with an entry, which is good. But in terms of coding it into the template, I’m a bit confused what tag to utilize. It seemed much easier and intuitive before. What would you recommend?

  • #9 / Sep 14, 2011 4:10pm

    Mark Bowen

    12637 posts

    Hi aquaadmin,

    Ah yes I thought you were using the File field.

    As mentioned there are (at the moment) only a limited amount of variables available to those tags and it looks as though width & height are not in there yet.

    The File Manager and all its associated tags are being worked on and updated as I write this though and I know that this is an area which has been mentioned before so I’m sure it will definitely be looked at when the developers deal with updating the File Manager.

    For now though you are welcome to make a Feature Request to add in those variables (I believe one may already exist) and you could utilise something like the add-on I mentioned earlier to tide you by in the meantime.

    Hope that helps a bit.

    Thanks,

    Mark

  • #10 / Sep 14, 2011 5:53pm

    aquaadmin

    64 posts

    Ok that explains it. Thank you for the detail. I’m looking forward to the update!

  • #11 / Sep 14, 2011 5:58pm

    Mark Bowen

    12637 posts

    Hi aquaadmin,

    Thanks. I’ll go ahead and close this thread but if anything else crops up then please don’t hesitate to post again as needed.

    Cheers,

    Mark

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases