Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2009-05-13 00:40:46

midmood
Member
From: Rome, Italy
Registered: 2007-07-20
Posts: 68
Website

retrieve article image ID content (or similar)

Hi all,

How do I retrieve (by txp tags) the ID of an image included in an article, or the content of the article_image field in the write tab?

thank you for your help :-)

Simone (Italy)

Offline

#2 2009-05-13 00:43:35

maniqui
Member
From: Buenos Aires, Argentina
Registered: 2004-10-10
Posts: 3,070
Website

Re: retrieve article image ID content (or similar)

Not possible (afaik) by using just TXP built-in tags. Try upm_image, smd_gallery or soo_image.


La música ideas portará y siempre continuará

TXP Builders – finely-crafted code, design and txp

Offline

#3 2009-05-13 00:48:20

midmood
Member
From: Rome, Italy
Registered: 2007-07-20
Posts: 68
Website

Re: retrieve article image ID content (or similar)

thank you… i try the plugins you suggested me, even if i need just to the id number to append to a customized url.
This is going into a javascript variable to perform an effect (oh… my english :-(

Offline

#4 2009-05-13 01:00:10

maniqui
Member
From: Buenos Aires, Argentina
Registered: 2004-10-10
Posts: 3,070
Website

Re: retrieve article image ID content (or similar)

You will probably find them useful for other crazy ideas that could come up ;)

Of course, you can probably retrieve the value on the article_image field by just using a few PHP lines, but I leave that for the experts.


La música ideas portará y siempre continuará

TXP Builders – finely-crafted code, design and txp

Offline

#5 2009-05-13 01:14:59

midmood
Member
From: Rome, Italy
Registered: 2007-07-20
Posts: 68
Website

Re: retrieve article image ID content (or similar)

grrr.

soo_image fits nearly perfect my purpose, but I need onMouseOver option, and as far I can see, there’s only the option to use onClick

Offline

#6 2009-05-13 01:20:58

jsoo
Plugin Author
From: NC, USA
Registered: 2004-11-15
Posts: 1,793
Website

Re: retrieve article image ID content (or similar)

midmood wrote:

soo_image fits nearly perfect my purpose, but I need onMouseOver option, and as far I can see, there’s only the option to use onClick

Where do you need onmouseover to appear — in the img tag itself, or in the a tag of a linked thumbnail?


Code is topiary

Offline

#7 2009-05-13 01:29:03

midmood
Member
From: Rome, Italy
Registered: 2007-07-20
Posts: 68
Website

Re: retrieve article image ID content (or similar)

ok, i explain the problem simply:

I’m trying to adapt a javascript which allow me to show a list of linked thumbnail. When i move the mouse over the thumbnail, the full size image shows in another part of the page.

Apart from the javascript, the tag’s combination i use is this one:

<a href="<txp:permlink />" title="<txp:title />" onMouseOver="showImage('<txp:article_image />')"><txp:article_image thumbnail="1" /></a>

The only part not working is the txp:article_image tag inside the showImage….
You can see it in action here: http://www.fabioborselli.com/violetab/negozio/ (sorry, really messy, layout testing there :-)

if I put a real image url instead of the tag, the script works….

I need to find a way to feed the generated image link to the showImage part… don’t know how… please help me .-)

Offline

#8 2009-05-13 01:47:35

jsoo
Plugin Author
From: NC, USA
Registered: 2004-11-15
Posts: 1,793
Website

Re: retrieve article image ID content (or similar)

Someone else asked for something similar today. See my reply in the soo_image support thread. I could add an onmouseover attribute to soo_image, but since what you want is a link to the article I think it will work better using your code but with a tag that produces the article-image URL, as in the link above. I’m pretty sure you could also do this with smd_gallery.


Code is topiary

Offline

#9 2009-05-13 02:03:18

midmood
Member
From: Rome, Italy
Registered: 2007-07-20
Posts: 68
Website

Re: retrieve article image ID content (or similar)

I used the soo_image_url tag.
Now the behaviour is the following.

If I pass the mouse over the thumbnail i see the div holder for the bigger image showing (top right corner)
But what i see is just a “broken link image”, such as when you have a wrong extension for the image.

If I retrieve the url by right clicking the place where the image is supposed to show, i can see the url is almost correct

the right url is infact http://www.fabioborselli.com/violetab/images/84.png
the url generated by the soo_image_url is http://www.fabioborselli.com/images/84.png

that’s strange… if I modify the images path in the preferences… i can’t see anymore either the thumbnail and the full size image…

Offline

#10 2009-05-13 02:22:00

jsoo
Plugin Author
From: NC, USA
Registered: 2004-11-15
Posts: 1,793
Website

Re: retrieve article image ID content (or similar)

Please see my reply here.


Code is topiary

Offline

#11 2009-05-13 02:31:18

midmood
Member
From: Rome, Italy
Registered: 2007-07-20
Posts: 68
Website

Re: retrieve article image ID content (or similar)

Oh… yes!
I could never thank you enough, jsoo…
You solved me a big problem.

Offline

#12 2009-05-13 12:02:40

jsoo
Plugin Author
From: NC, USA
Registered: 2004-11-15
Posts: 1,793
Website

Re: retrieve article image ID content (or similar)

Glad it works. soo_image is a big plugin to use if all you want from it is article image URL. All you really need is something like this:

function soo_article_image_url () {
	global $thisarticle, $img_dir;
	assert_article();
	$img = $thisarticle['article_image'];
	if ( ! $img )
		return;
	if ( is_numeric($img) ) {
		$rs = safe_row('*', 'txp_image', 'id = ' . intval($img));
		if ( $rs )
			return hu . $img_dir . '/' . $img . $rs['ext'];
	}
	else
		return $img;
}

This isn’t one of my officially supported plugins, but here it is if you want to install it:

YTo5OntzOjQ6Im5hbWUiO3M6MjE6InNvb19hcnRpY2xlX2ltYWdlX3VybCI7czo3OiJ2ZXJzaW9uIjtzOjM6IjAuMSI7czo2OiJhdXRob3IiO3M6ODoiSmVmZiBTb28iO3M6MTA6ImF1dGhvcl91cmkiO3M6MjE6Imh0dHA6Ly9pcHNlZGl4aXQubmV0LyI7czoxMToiZGVzY3JpcHRpb24iO3M6MzY6IkRpc3BsYXkgVVJMIG9mIGN1cnJlbnQgYXJ0aWNsZSBpbWFnZSI7czo0OiJ0eXBlIjtpOjA7czo0OiJoZWxwIjtzOjEwMTA6IjxzdHlsZSB0eXBlPSJ0ZXh0L2NzcyI+CmRpdiNzZWRfaGVscCBwcmUge3BhZGRpbmc6IDAuNWVtIDFlbTsgYmFja2dyb3VuZDogI2VlZTsgYm9yZGVyOiAxcHggZGFzaGVkICNjY2M7fQpkaXYjc2VkX2hlbHAgaDEsIGRpdiNzZWRfaGVscCBoMiwgZGl2I3NlZF9oZWxwIGgzLCBkaXYjc2VkX2hlbHAgaDMgY29kZSB7Zm9udC1mYW1pbHk6IHNhbnMtc2VyaWY7IGZvbnQtd2VpZ2h0OiBib2xkO30KZGl2I3NlZF9oZWxwIGgxLCBkaXYjc2VkX2hlbHAgaDIsIGRpdiNzZWRfaGVscCBoMyB7bWFyZ2luLWxlZnQ6IC0xZW07fQpkaXYjc2VkX2hlbHAgaDIsIGRp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