From fb74b700493209764d8981130daf65bfec5de07d Mon Sep 17 00:00:00 2001 From: real_nowhereman Date: Mon, 23 Aug 2010 07:08:08 +0000 Subject: [PATCH] support for custom alt, title attributes in [img] --- fp-plugins/bbcode/plugin.bbcode.php | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/fp-plugins/bbcode/plugin.bbcode.php b/fp-plugins/bbcode/plugin.bbcode.php index b544a74..a7bae85 100644 --- a/fp-plugins/bbcode/plugin.bbcode.php +++ b/fp-plugins/bbcode/plugin.bbcode.php @@ -185,7 +185,21 @@ function do_bbcode_img($action, $attributes, $content, $params, $node_object) { $float = ' class="center" '; $popup_start = ''; $popup_end = ''; + $alt = $title = basename($actualpath); + $useimageinfo = true; // use IPTC info + + if (isset($attributes['alt'])) { + $alt = wp_specialchars($attributes['alt']); + $useimageinfo = false; + } + + if (isset($attributes['title'])) { + $title = wp_specialchars($attributes['title']); + $useimageinfo = false; + } + + $img_size = array(); // let's disable socket functions for remote files @@ -195,7 +209,7 @@ function do_bbcode_img($action, $attributes, $content, $params, $node_object) { $img_size = @getimagesize($actualpath, $img_info); $absolutepath = BLOG_BASEURL . $actualpath; - if (function_exists('iptcparse')) { + if ($useimageinfo && function_exists('iptcparse')) { if ($img_size['mime'] == 'image/jpeg') { // tiffs won't be supported