This patch permits to insert images from other web, so you don't need uploading nothing if you prefer. This patch also simplifies the code with alignments, at previous related patch.
sub UploadLink { my ($filename) = @_; my ($id, $image, @image); my ($param, $caption, $imgName); my ($targetWeb, $url, $leftChar); my $html; @image = split (/:/, $filename); $id = $OpenPageName; $leftChar = &GetPageDirectory($id); return $filename if ($UploadUrl eq ''); # No bad links if misconfigured # $UploadUrl .= '/' if (substr($UploadUrl, -1, 1) ne '/'); # End with / $targetWeb = "$UploadUrl/$leftChar/$id/"; if ($image[2] eq '') {$image[2] = $image[0];} if ($image[1] eq '') {$image[1] = ' ';} if ($image[0] ne 'left' && $image[0] ne 'center' && $image[0] ne 'right') {$image[0] = 'left';} if ($image[0] eq 'left') {$html .= '<div style="clear"></div><div style="float: left;">';} if ($image[0] eq 'right') {$html .= '<div style="float: right;">';} if ($image[0] eq 'center') { # $html .= '<div style="clear:both; "></div>'; $html .= '<div margin-left:auto; margin-right:auto; align=center>'; } if (grep /\//,$image[2]) { $html .= '<a href="' . 'http://' .$image[2]. '">'; $html .= '<div class=graph>' . &ParseParagraph('http://' .$image[2]) .'</div>' ; $html .= '</a>'; $html .= '' . '<p class=graph style="text-align:center;">' . $image[1]. '</p>'; } else { $url = $targetWeb . $image[2]; if (&ImageAllowed($url)) { $html .= '<a href="' . $url . '">'; $html .= "<img class=graph src=\"" . $url . '" alt="upload:' . $image[2] . '">'; $html .= '</a>'; $html .= '' . '<p class=graph style="text-align:center;">' . $image[1]. '</p>'; } if (!&ImageAllowed($url)) { $html .= 'upload:' . $image[2]; } } if ($image[0] eq 'left' || $image[0] eq 'center') { $html .= '</div>'; } if ($image[0] eq 'right') { $html .= '</div><div style="clear"></div>'; } $html .= '</a>'; return $html; }
if ($UseUpload) { s/$UploadPattern/&StoreUpload($1)/geo; }In 2nd place:
s/\[$UrlPattern\]/&StoreBracketUrl($1, "", 0)/geo;It permits include the whole url on the new markup (upload:alignement:caption:http://foo.bar/baz.ext).
--JuanmaMP