n: smd_imagery | v: 0.10 | f: /

Documentation for the Textpattern plugin smd_imagery by Stef Dawson follows this short message from our sponsor ;-)

Plugin list buttonPlugin download buttonCompressed plugin download button
h1. smd_imagery Insert images into your Write panel. Very handy for people who run photoblog or image-heavy sites, or those who categorise images for inclusion in articles. h2. Features * Replace category names with image id values in the Article Image field. * Comma-separate category names to grab id values from them all at once. * Order of image id values is preserved. * Craft custom image sets based on an image category, or load images from an article field. * Build a list of id values or a complete tag to paste into your article via a template. * Fast and efficient: only one query. h2. Installation / Uninstallation p(information). Requires Textpattern 4.5+ p(information). Recommended: Textpattern 4.6+ "Download the plugin":https://github.com/Bloke/smd_imagery/releases, paste the code into the Textpattern _Admin->Plugins_ panel, install and enable the plugin. Visit the "forum thread":http://forum.textpattern.com/viewtopic.php?id=YYYYY for more info or to report on the success or otherwise of the plugin. For bug reports, please "raise an issue":https://github.com/Bloke/smd_imagery/issues. To uninstall, delete the plugin from the _Admin->Plugins_ panel. h2. Usage Once installed, two new buttons labelled _Fetch_ and _Manage_ appear below the Article Image field. Both of these allow you to insert images into your article, but they do it in different ways, as detailed below. h3. Populating Article Image by category Use the _Fetch_ button to immediately ask the database to grab the image id values from any category names listed in the _Article Image_ field. If you are using Textpattern v4.6.0 or later, just save or publish the article: the image id values will be fetched for you automatically and populated in the _Article Image_ box. Notes: * The order of id values already present in the Article Image field is perserved after replacement. * Any categories that do not exist (or typos) will remain in the list. * Any category names that are wholly numeric will _not_ be fetched, as the plugin cannot distinguish between them and id values. * The maximum number of characters -- incuding commas and spaces -- that can be stored in the Article Image field is 255 by default. This is why the plugin doesn't put spaces between its id values. If you insert a category name that results in the image id list exceeding this number of characters, the article will throw an error when saving. h3. Examples h4. Example 1 * Create an image category called @holiday_snaps@. * Upload some images and assign them to that category. * On the Write panel, type @holiday_snaps@ into the Article Image field. * Hit _Fetch_. * Note that @holiday_snaps@ has been replaced with a list of image id values that were assoaciated with that category. h4. Example 2 * Create a few image categories. * Upload some images to each. * On the Write panel, list the image category names in the Article Image field. * Hit _Fetch_ and note the content of the Article Image field has been populated with the id values from each of the categories. h4. Example 3 Do something similar to Example 2, but before httng the _Fetch_ button, sprinkle some other image id values in the Article Image field. For example: bc. 15, 42, holiday_snaps, 6, night-out, 129 After hitting _Fetch_, note that the id values pulled from the database are replaced in-situ. Also note that if one or more of the id values you've typed are the same as any in the categories you're fetching, the duplicates will not be fetched. Further, if all of the id values that comprise a category are already in the Article Image field, that category name will remain in the list. h3. Crafting image lists by hand For more control over your image lists, and where you can insert the resulting values, use the _Manage_ button. This will pop up a dialog box that contains a radio button to allow you to choose between two methods of fetching images: * By category: to load images by the chosen category, at the chosen size, ordered by the chosen property in the desired order depicted by the arrow. * From field: to load images from the selected article field, in the order defined in that field. In the latter case, the plugin searches for images in the following order: # A straight list of id values. # @