HTML Logo by World Wide Web Consortium (www.w3.org). Click to learn more about our commitment to accessibility and standards.

Moving forward with Composr

ocPortal has been relaunched as Composr CMS, which is now in beta. ocPortal 9 will be superseded by Composr 10.

Head over to compo.sr for our new site, and to our migration roadmap. Existing ocPortal member accounts have been mirrored.


Help on "Attachment" comcode [Solved]

Login / Search

 [ Join | More ]
 Add topic 
Posted
Rating:
#62533 (In Topic #13594)
Avatar

Community saint

adding width and height parameters

I'm soliciting help to solve my problem of finding the correct syntax to insert the width and height parameters to the attachment comcode.

Here is my objective:


Here is my misstated code:O_o

Code

[attachment type="auto" description="" width= "190px" height= "290px"]202[/attachment]
Thanks for the any enlightenment!
Jean
Back to the top
 
Posted
Rating:
#62548
Avatar

Hi,

I'm a bit confused I'm afraid, so perhaps if you could restate your objective in different terms I might follow.

However from my perspective I'd say use type="inline" and then just upload an image that is of the dimensions you want. Resizing images on the fly is likely to not work so well especially on IE which doesn't have any blended resizing.


Become a fan of ocPortal on Facebook or add me as a friend. Add me on on Twitter.
Was I helpful?
  • If not, please let us know how we can do better (please try and propose any bigger ideas in such a way that they are fundable and scalable).
  • If so, please let others know about ocPortal whenever you see the opportunity.
  • If my reply is too Vulcan or expressed too much in business-strategy terms, and not particularly personal, I apologise. As a company & project maintainer, time is very limited to me, so usually when I write a reply I try and make it generic advice to all readers. I'm also naturally a joined-up thinker, so I always express my thoughts in combined business and technical terms. I recognise not everyone likes that, don't let my Vulcan-thinking stop you enjoying ocPortal on fun personal projects.
  • If my response can inspire a community tutorial, that's a great way of giving back to the project as a user.
Back to the top
 
Posted
Rating:
#62549
Avatar

Ah yes, also I checked our code and our default image template doesn't use the width/height parameters. Those were originally intended for videos (which can't auto-size themselves) but it threw me at first too.
You could add it in by putting {+START,IF,{$NEQ,{A_WIDTH},240}} width="{A_WIDTH|}" height="{A_HEIGHT|}{+END}" into the ATTACHMENT_IMG_MINI template.


Become a fan of ocPortal on Facebook or add me as a friend. Add me on on Twitter.
Was I helpful?
  • If not, please let us know how we can do better (please try and propose any bigger ideas in such a way that they are fundable and scalable).
  • If so, please let others know about ocPortal whenever you see the opportunity.
  • If my reply is too Vulcan or expressed too much in business-strategy terms, and not particularly personal, I apologise. As a company & project maintainer, time is very limited to me, so usually when I write a reply I try and make it generic advice to all readers. I'm also naturally a joined-up thinker, so I always express my thoughts in combined business and technical terms. I recognise not everyone likes that, don't let my Vulcan-thinking stop you enjoying ocPortal on fun personal projects.
  • If my response can inspire a community tutorial, that's a great way of giving back to the project as a user.
Back to the top
 
Posted
Rating:
#62565
Avatar

Community saint

Chris Graham said

Ah yes, also I checked our code and our default image template doesn't use the width/height parameters. Those were originally intended for videos (which can't auto-size themselves) but it threw me at first too.
You could add it in by putting {+START,IF,{$NEQ,{A_WIDTH},240}} width="{A_WIDTH|}" height="{A_HEIGHT|}{+END}" into the ATTACHMENT_IMG_MINI template.



Thanks for this info Chris! This could turn out to be quite useful, but in my case, and I must apologize for the confusion, as I've omitted to say that I'm trying to fit a document attachment, such as .doc, .zip, inside my div, and not necessarily an image for which the size, as you've mentioned can easily be controlled before insertion. This takes place on a custom comcode page that I'm adding to a zone.

Playing with Firebug, I can accomplish this easily, but I do not necessarily want to apply this to the global class .attachment. Therefore, I was entertaining the idea that I can incorporate the Width and Height in the Attachment Comcode itself as suggested in its documentation (see image below). I have tried several combinations of width and height, but none seemed to fit the bill. It might just be a matter of syntax, which eludes me.
Attachment
» Download: bbb0856a506dcc2ec5a367c451995621.dat (3 Bytes, 0 downloads so far)

Back to the top
 
Posted
Rating:
#62567
Avatar

Ah right. I think you're referring to the fieldset element then. In the CSS there's a width set on the .attachment selector. Change that to use the min-width property and lower the value. Alternatively it might be possible to remove the width and set "display: inline-block" instead (I've never tried that on a fieldset).


Become a fan of ocPortal on Facebook or add me as a friend. Add me on on Twitter.
Was I helpful?
  • If not, please let us know how we can do better (please try and propose any bigger ideas in such a way that they are fundable and scalable).
  • If so, please let others know about ocPortal whenever you see the opportunity.
  • If my reply is too Vulcan or expressed too much in business-strategy terms, and not particularly personal, I apologise. As a company & project maintainer, time is very limited to me, so usually when I write a reply I try and make it generic advice to all readers. I'm also naturally a joined-up thinker, so I always express my thoughts in combined business and technical terms. I recognise not everyone likes that, don't let my Vulcan-thinking stop you enjoying ocPortal on fun personal projects.
  • If my response can inspire a community tutorial, that's a great way of giving back to the project as a user.
Back to the top
 
Posted
Rating:
#62571
Avatar

Community saint

Chris Graham said

Ah right. I think you're referring to the fieldset element then. In the CSS there's a width set on the .attachment selector. Change that to use the min-width property and lower the value. Alternatively it might be possible to remove the width and set "display: inline-block" instead (I've never tried that on a fieldset).
Many Thanks Chris!:)

Applying the "display: inline-block" along with some minor margin adjustments on the .attachment selector did it nicely for me. I will make good use of it in my themeing projects.

However, I would be interested to know eventually if the width and height parameters, as suggested in the comcode documentation, can be inserted directly- similarly to the 'block' comcode. I find the existing documentation very useful with many good examples of code syntax, but some interesting parameters are left without code examples as it is the case for "attachment".
Back to the top
 
Posted
Rating:
#62572
Avatar

Maybe {+START,IF,{$NEQ,{A_WIDTH},240}} style="width: {A_WIDTH|}px; height: {A_HEIGHT|}px"{+END} in ATTACHMENT.tpl.

A list of bad spots in the documentation would be very welcome :).


Become a fan of ocPortal on Facebook or add me as a friend. Add me on on Twitter.
Was I helpful?
  • If not, please let us know how we can do better (please try and propose any bigger ideas in such a way that they are fundable and scalable).
  • If so, please let others know about ocPortal whenever you see the opportunity.
  • If my reply is too Vulcan or expressed too much in business-strategy terms, and not particularly personal, I apologise. As a company & project maintainer, time is very limited to me, so usually when I write a reply I try and make it generic advice to all readers. I'm also naturally a joined-up thinker, so I always express my thoughts in combined business and technical terms. I recognise not everyone likes that, don't let my Vulcan-thinking stop you enjoying ocPortal on fun personal projects.
  • If my response can inspire a community tutorial, that's a great way of giving back to the project as a user.
Back to the top
 
Posted
Rating:
#62578
Avatar

Community saint

Thanks again Chris!

In this case, I was not looking to modify the template, but I was referring to the "comcode" parameters in an XHTML/comcode page, or what about here in this post for that matter? Such as, if I would want to add a "Box" of a certain dimension, I could simply use the following comcode:
test

Code

[box dimensions="50px|50px"]test[/box]
My attempt to do the same with "attachment" did not work and I was wondering if it wasn't just because of bad syntax from my part. I tried different combination with % and px, and since there are no examples to refer to, all my attempts were obviously wrong:

Code

[attachment type="auto" description="" width= "190px" height= "290px"]202[/attachment]
Back to the top
 
Posted
Rating:
#62580
Avatar

Exactly :)… which is why I used the template's A_WIDTH/A_HEIGHT parameters which come from the Comcode width/height parameters in my sample change. It should allow it to just feed through, as you intended.


Become a fan of ocPortal on Facebook or add me as a friend. Add me on on Twitter.
Was I helpful?
  • If not, please let us know how we can do better (please try and propose any bigger ideas in such a way that they are fundable and scalable).
  • If so, please let others know about ocPortal whenever you see the opportunity.
  • If my reply is too Vulcan or expressed too much in business-strategy terms, and not particularly personal, I apologise. As a company & project maintainer, time is very limited to me, so usually when I write a reply I try and make it generic advice to all readers. I'm also naturally a joined-up thinker, so I always express my thoughts in combined business and technical terms. I recognise not everyone likes that, don't let my Vulcan-thinking stop you enjoying ocPortal on fun personal projects.
  • If my response can inspire a community tutorial, that's a great way of giving back to the project as a user.
Back to the top
 
Posted
Rating:
#62582
Avatar

Community saint

Chris Graham said

Exactly :)… which is why I used the template's A_WIDTH/A_HEIGHT parameters which come from the Comcode width/height parameters in my sample change. It should allow it to just feed through, as you intended.

Got you! I don't know why I did not see it like that the first time you posted it. :o

This is brilliant and I will have fun with this–Thanks!:thumbs:

Jean
Back to the top
 
1 guests and 0 members have just viewed this: None
Control functions:

Quick reply   Contract

Your name:
Your message: