[pmwiki-users] Random background image with text over it?

Tegan Dowling tmdowling at gmail.com
Mon Jul 16 14:43:15 CDT 2007


On 7/15/07, Tegan Dowling <tmdowling at gmail.com> wrote:
> I've been able to put backgrounds on pages, divs, and table-cells
> using instructions from
> http://www.pmwiki.org/wiki/Cookbook/BackgroundImages, which allows
> fore-ground text-content for the page to be added and edited in the
> normal way.
>
> Now I'd like to be able to have the background behind the text change,
> randomly selecting from a specified bunch of images, possibly by
>
> showing each image alone on a page, and using
> (:pagelist order=random fmt=#include ... :),
>
> and/or
>
> showing each in a [[#anchortagged]] section of a single page, and using
> (:include {Groupname/Pagename$RandomSection}:) -- per the recipe at
> http://www.pmwiki.org/wiki/Cookbook/RandomQuote
>
> _What I tried_:
> I created several pages in group Test, each displaying, in the normal
> manner, an image.
>
> And I created a page Test/RandomImage1, and on it put (:pagelist
> group=Test order=random count=1 fmt=#include
> name=-ImageRotation2,-Template self=0:) to get it to display a page
> (and thereby display a picture) from the target collection.
>
> And I created a page Test/RandomImage2, and put on it
> --------------------------------------
>
> (:div style='border:4px groove #99f; padding:10px;
> background-image:url([=http://www.mysitename.com/Test/ImageRotation1=])':)
>
> Some text here
>
> (:divend:)
>
> --------------------------------------
> But it didn't work; I get the border and the text, but not the image.
> Thinking maybe this was because the URL given isn't the address of a
> .jpg or other image, I even tried to fake that by adding an "fragment
> identifier", using
> (:...background-image:url([=http://www.mysitename.com/Test/ImageRotation1#file.jpg=])':),
> but that didn't work either.

Here's what works, in case anyone else is interested in, for example,
having a random banner-image behind some fore-ground text:

Each image is displayed on its own page as the background behind an
(:include ...:) statement, where the material that's included is
[[#anchor-tagged]] fore-ground text (maintained wherever that's
maintained). So there's a page for each image, and all that's on each
page is the image behind the included text, like this:

(:div style='border:4px groove #99f; padding:10px;
background-image:url([=http://www.mysitename.com/Test/HomePage?action=download&upname=ImageNameHere.jpg=])':)

(:include Test/TextPage#incl#inclend:)

(:divend:)

THEN on Test/ImageRotation, I have

(:pagelist group=Test order=random count=1 fmt=#include
name=-TextPage,-Template,-HomePage self=0:)

It looks like the other version of random-inclusion would work this
way, too, if all the backgrounds were displayed, with included
fore-ground text, on a single page, each demarcated by
[[#anchor-tags]], and then the randomizing code could be (:include
{Groupname/Pagename$RandomSection}:) -- per the recipe at
http://www.pmwiki.org/wiki/Cookbook/RandomQuote (unless there were a
problem with tagged sections inside tagged sections, and including an
inclusion).

But in any case, it's all too messy for most non-programming authors
to be asked to do - what with having to remember all the rules for
formatting, sizing, naming and displaying the images and including the
fore-ground text.



More information about the pmwiki-users mailing list