Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#37 2010-01-27 08:54:54

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,243
Website GitHub

Re: Adding more consistent image functionality

Natalya wrote:

Looks like the link attribute now has a possible value of auto. How does this differ from link="1"?

link="auto" simply means you shouldn’t have to worry about it doing what you expect. For example…

No link; just the raw URL:

<txp:image_url /> renders http://site.com/images/N.jpg

Automatically linked because of the contained content:

<txp:image_url>Click me</txp:image_url> renders <a href="http://site.com/images/N.jpg">Click me</a>

Link using the URL as the link text:

<txp:image_url link="1" /> renders <a href="http://site.com/images/N.jpg">http://site.com/images/N.jpg</a>

No link:

<txp:image_url link="0" /> renders http://site.com/images/N.jpg
<txp:image_url link="0">Not Linked</txp:image_url> (which is a bit pointless!) renders Not Linked

So in theory you shouldn’t need to use the link attribute unless you’re doing something pretty special, since the default auto saves you typing. Does that clear things up a bit?


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#38 2010-01-27 14:27:44

Natalya
New Member
From: Essen, DE
Registered: 2010-01-23
Posts: 5

Re: Adding more consistent image functionality

Oh cool, thanks. Didn’t think about that.

Offline

#39 2010-02-19 20:43:58

bici
Member
From: vancouver
Registered: 2004-02-24
Posts: 2,070
Website Mastodon

Re: Adding more consistent image functionality

Wondering if what this plugin does is the way to go with what I wish to do:

I have two people who will be submitting articles/entries to the blog section of my latest TxP site. What I would like to do is have an easy fool proof way for them to submit an image (either Full size- 500px wide or Half size=250px wide) and have the image inserted automagically at the end of the first paragraph of the body or failing this, at the end of the body tag. It has to be as easy as possible.

Suggestions on alternate ways most welcome…

cheers

PS I would also need to be able to add a CSS class to the images, basically a 1px border around the image , and flow text around the half image.

I have done this in EE by using special fields. Hoping i can find an easy way to duplicate this in TxP.


…. texted postive

Offline

#40 2010-02-20 13:46:51

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,243
Website GitHub

Re: Adding more consistent image functionality

bici wrote:

Wondering if what this plugin does is the way to go with what I wish to do:

What plugin? :-) This is a discussion about improving the core image output functionality in terms of a new set of image tags. But…

an easy fool proof way for them to submit an image…

OT: If you mean directly from the Write tab there are a few plugins that can help (lam_image_uploader springs to mind, there are more I’m sure). These will put the image ID in the article image field and then…

… have the image inserted automagically at the end of the first paragraph of the body or failing this, at the end of the body tag.

The latter can be achieved with:

<txp:if_article_image>
  <txp:article_image class="img_class" wraptag="div" />
</txp:if_article_image>

Putting stuff easily into the body text itself is probably best achieved with jQuery at the moment. You can add the image to the article image field using whichever method you like and then use jQuery on page load to move it to the end of the 1st paragraph. If you set it to be hidden in its original location via a CSS class called .hidden set to display:none; and then remove the class on successful move you won’t get the image flashing up before its ready. Untested, but something like:

jQuery(function() {
   jQuery("div.img_class").insertAfter("body p:eq(2)");
   jQuery("div.img_class").toggleClass("hidden")
})

The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

Board footer

Powered by FluxBB