Sat Jun 05, 2004

Random Image Plugin (txp:mem_randimg)

I created a plugin to randomly fetch an image from a list of categories and then populate a form with its values.

file: mem_randimg.txt [6.57KB]
Category: Textpattern
download: 1960

Tag (wrap with < and > Result
txp:mem_img An html img tag that contains alt, height and width for the image.
txp:mem_img_url A url path from the root to the image.
txp:mem_img_thumbnail An html img tag that contains alt, height and width for the image’s thumbnail.
txp:mem_img_thumbnail_url A url path from the root to the thumbnail.
txp:mem_img_caption The image’s caption.
txp:mem_img_alt The specified ALT value for the image.
txp:mem_img_category The image’s category.
txp:mem_img_width The image’s width.
txp:mem_img_height The image’s height.
txp:mem_img_author The name of the image uploader.
txp:mem_img_date The date the image was uploaded.

Edit 6/23/2004: Added below example form

Image:
Url:
Thumbnail:
Url:
Caption:
Alt:
Category:
Width:
Height:
Author:
Date:

Comment

This isn’t working for me.

Brian · 06/14/04 09:29 AM · #

Could you elaborate and/or look here?

Manfre · 06/14/04 09:49 AM · #

Could you give some examples of using both mem_randimg and some of the other mem_img_xxx tags?

— Marco · 06/20/04 01:25 AM · #

I must be sooo blind, but I simply cannot find the link to the download of the plugin?

Oliver Nielsen · 05/08/05 08:00 AM · #

me neither.

alex · 05/09/05 11:57 AM · #

I missed this download link when upgrading to rc3.

Manfre · 05/15/05 12:09 AM · #

I have tested this plug-in to display random images inside an article and it works.
I mean, I put the tag inside an article, and it did work flawlessly.

Now, my question is
Is it “correct”, when possible, to use txp tags inside articles?
or this kind of practice shoud be avoided?

Maniquí · 06/13/05 03:36 PM · #

txp tags were intended to be used inside of an article, page, or form. Each tag defines whether or not it will allow sub tags to be processed. Most tags that use forms or surround text support this behavior.

Manfre · 06/15/05 03:26 AM · #

I would like to know if it is possible to use this plugin for pictures in the textpattern css. For example showing random background images …

— Stewart · 05/10/06 07:55 AM · #

I don’t know if your question regarding CSS-background-images has been answered meanwhile, but since I needed the same thing, I found the following solution:

Add an additional style setting within the page template, after the css-importing-tag, which simply defines the background image for any selector you need.
This will overwrite the separate-css-based definition with the randomly generated img-url.

I did it like this (replace [selector] by your selector, e.g. div):

with the form “background” simply containing this tag:

— Michael Schlierbach · 05/19/06 05:43 PM · #

hey manfre, the tag txp:mem_img outputs width/height of image using inline styles… but omits the values which are required! (need to add ‘px’ after the values)

— nardo · 07/23/06 10:29 PM · #

I contacted Michael and try to supply the missing code above.

first part

#head
{

text-align: center; height: auto; float: left; width: 100%; background: #eee url(/design/platz3.jpg) top left no-repeat; padding-bottom: 10px;
}

#head a, #head a img
{border: 0; text-decoration: none;}

— uli · 08/22/06 09:35 AM · #

second part

gee, limitited text size!

— uli · 08/22/06 09:37 AM · #

second part
< txp:mem_img_url / >

(geeeee, limited text size and no txp tags allowed ;)

— uli · 08/22/06 09:43 AM · #

Commenting is closed for this article.