====== NP_RandomImg.php ====== //This plugin can be used to show a random image on your [[http://www.nucleuscms.org/|Nucleus]] blog and link these images to somewhere else.// ^General Plugin info ^^ ^Current Version: | 1.3 | ^Download: | http://foto-cs.de/blog/downloads/NP_RandomImg-1.3.tgz (format: tgz, size: 3.0 kB, 2 files) or {{:np_randomimg-1.3.zip|here}}| ^Forum Thread: |http://forum.nucleuscms.org/viewtopic.php?p=34902#34902| ^Author: | Carsten Schurig (cs42) http://foto-cs.de/blog/| =====Installing===== - Unpack the file and upload the contents to your plugin directory - Install the plugin... - Set the options in your blog settings page and add <%RandomImg%> to your skin =====How to use the plugin===== Besides showing a random image on your page, with this plugin it is possible to * define a section title * define a title for every image (is used as ''alt'' tag too), * specify the dimensions (''width'' and ''height'' property), * give a place to link this image to. =====Available SkinVar===== * use ''<%RandomImg%>'' to show an image on your page * use ''<%RandomImg(title)%>'' to get the section title text =====Options===== All options are blog specific, so they are in the blog settings area. * Section title: a text to use as title for your random image section * Where are the images?: While you could give a full path to every image, you can define a base path for all images here, e.g. ''/images''. The plugin does not prepend anything other to the image href than this parameter. * //Base to a gallery to link to//: If you want link these images to a gallery you can define a base path to the gallery here. For the definition of the file to link to, see below. * //The definitions for the images to display//: Here you define the parameters of the images to display. The definitions of one image are given per line and the fields are seperated by a pipe. The fields are: - image file name - file name to link to - image title - width of image - height of image Empty fields are ignored and to get valig XHTML output, the properties are dropped. If no image file name is given, no ''img'' tag is set and if the file name to link to is empty, no link is defined. A new line starts a new definition, empty lines are supposed to be ignored. So if you would like to show an image ''thumb.jpg'' with a title of //This is a nice picture//, a width of ''100'' and heigt of ''200'', and like to link it to ''sample.html'' you have to add: thumb.jpg|sample.html|This is a nice picture|100|200 =====Bugs===== * You could say it's a bug, that the image dimensions are not inserted automatically, but this has been done one purpose: - it's my first ''PHP'' code, so I did want to keep the code as simple as possible, - it should be faster than to get the image dimensions using some additional library (e.g. ''GD'') =====History===== * version 1.3 [2005-07-10]: * added the section title option * version 1.2 (first published version) [2005-02-27]: * moved the image definitions from a file to a blog setting, so it's editable from the blog settings page [2005-04-27] * version 1.1: * code clean up for release * added some empty field checking, so that valid XHTML code is created, even if fields are empty * version 1.0: * initial plugin, based on NP_Random v1.2, not released (just used on my [[http://foto-cs.de/blog/|blog]]) ===== Plugin review ===== NP_RandomImg version 1.3 works with Nucleus CMS 3.31 - 2007-10-28 Armon