|
ExtendedImagesWithLinks<< Random Incl | Cookbook-V1 | Netflix Include >> Note: The recipes here are for PmWiki versions 0.6 and 1.0 only. For PmWiki 2.0 recipes, see Cookbook. GoalA script allows to add images (with a relative path) which are linked. Solutionsolved Code should be look like this:
# function to retrive width and height of the included image
function getimagedimension($path)
{
if($path!="")
{
$fullpath = getcwd().trim($path);
$sizearray=getimagesize($fullpath);
return $sizearray[3];
}
}
# include linked image
$BrowseDirectives['/\\[:imageincllink (.*):\\]/e'] = 'imginclink("$1")';
function imginclink($urlimg) {
$arrayt = explode (";",$urlimg);
$urlimgstr = '<a href="'.$arrayt[0].'"><img src="'.$arrayt[1].'" '.getimagedimension($arrayt[1]).'" border="0" alt=""></a>';
return Keep($urlimgstr);
}
DiscussionI don't want do this because in the result is an unwanted and
i want to get the size of the image by php-script and add See AlsoOnly for images with relative paths: (include in local/config.php) # include image with relative path, width, height but no <br> at the end
$DoubleBrackets['/\\[:relinclnobr (.*):\\]/e'] = "Keep(RelInclNoBr('$1'))";
function RelInclNoBr($img) {
$imgstr = "<img src=\"".$img."\" ".getimagedimension($img)." border=\"0\" alt=\"\">";
return $imgstr;
}
# include image with relative path, width, height with <br> at the end
$DoubleBrackets['/\\[:relincl (.*):\\]/e'] = "Keep(RelIncl('$1'))";
function RelIncl($img) {
$imgstr = "<img src=\"".$img."\" ".getimagedimension($img)." border=\"0\" alt=\"\"><br>";
return $imgstr;
}
Usage: [:relincl /path/to/image.jpg :] or add
and Use: HistoryComments & BugsContributorsCopyrightAlways GPL pmwiki-2.2.0-beta68 -- Last modified by {{el}}?
|