Hi susscorfa, welcome to phpwcms forum,
Joachim is right (he rarely is wrong)
, that is one way to do it (with article CONTENT PARTS) other way is to download the
RT (replacement tags) PACKAGE at
SourceForge Phpwcms-Addon project and use the RT with image + alt + tile + size... whatever you want.
You will download like 25 rep tags working as for today.
Otherwise, here is the individual code, just place it in phpwcms_template/inc_script/frontend_render/reptag_IMAGE_TAG.php
Then in any article/template you can use it
Code: Select all
<?php
/********************************************
From:
SourceForge Project: https://sourceforge.net/projects/phpwcms-addon/
Support: http://dev-brenner-b-e or http://www.phpwcms.de/forum/
REPTAG CODE: {IMAGE_SIZE:x:y:z} for size
REPTAG CODE: {IMAGE_AT:x:y} for ALT and TITLE attribute
REPTAG CODE: {IMAGE_ROLL:x:y:z:url} for ROLLOVER function
Developer(s): pSouper, breistch, Kosse
phpWCMS Version: all (frontend_render enabled)
Description:
Method based on My {RT}'s great idea by pSouper, altered version of a function found in include/inc_front/front.func.inc.php
These are 3 IMAGE replacement tags, if u want to add your own, just increase increase $search[n] & $replace[n]
1) You can set SIZE, with {IMAGE_SIZE:x:y:z} where x is the name of the picture, y width and z for height
2) You can set ALT and TITLE text, with {IMAGE_AT:x:y} where x is the name of the picture, y the name of ALT and TITLE attributes
3) You can set ROLLOVER function, with {IMAGE_ROLL:x:y:z:url} where url is the URL of the link, x picture's name, y rollover picture's name and z ALT, TEXT and NAME attribute
Caution: don't forget to upload you images in /picture folder and when you put your images names it is "image.gif" or "image.jpg" or "image.png" not just "image" ;)
Installation Summary: Just this file to add, nothing to edit.
Mod version: final
Download: https://sourceforge.net/projects/phpwcms-addon/
Support:
http://www.phpwcms.de/forum
********************************************/
// CODE
// My ImageTag function
$content["all"] = (myImageTag ($content["all"]));// parse the whole webpage $content["all"] is the fully rendered webpage your site displays
function myImageTag($string) { // parse the $string and replace all possible instances of the following {RT}'s
// Define new {RT}'s here....increase $search[n] & $replace[n] ;)
// place an image of given dimentions // usage: {IMAGE_SIZE:x,y} by breitsch
$search[0] = '/\{IMAGE_SIZE:(.*?):(.*?):(.*?)\}/';
$replace[0] = '<img src="picture/$1" border="0" width="$2" height="$3" alt=""';
// insert non db image standard plus ALT and TITLE attribute // usage: {IMAGE_AT:x,y} by Kosse
$search[1] = '/\{IMAGE_AT:(.*?):(.*?)\}/';
$replace[1] = '<img src="picture/$1" border="0" alt="$2" title="$2" />';
//insert non db image standard plus ALT and TITLE and ROLLOVER attribute // usage: {IMAGE_ROLL:x:y:z:url} by Kosse
$search[2] = '/\{IMAGE_ROLL:(.*?):(.*?):(.*?):(.*?)\}/';
$replace[2] = '<a href="$4" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage(\'$3\',\'\',\'picture/$2\',0)"><img src="picture/$1" name="$3" border="0" alt="$3" title="$3" /></a>';
// The replacements are done here....
$string = preg_replace($search, $replace, $string);
$string = str_replace('\'', ''', $string);
$string = str_replace('"', '"', $string);
return $string;// spit out the final webpage for display
}
?>
Cheers