出でよ!達人
投稿日: 2005年 3月 13日
先日のIImage-browserですが、imgにclass属性(class="image"とか)を追加して自動生成させたいんです。でも、できないんですよ。(わからないともいう) 下記のコードがその部分だと思うんですが、どう記入すればいいんでしょう?PHPの達人さん、教えてください。
-
function ib_make_html_img($image, $link=FALSE) {
-
global $rel_path,
$thumb_prefix,
$abs_path;
-
$html = '';
-
-
// ---- image code
-
if (FALSE !== $image) {
-
$html .= "<img src='" . $abs_path
-
-
if (0 !== $image['img']) // the getimagesize-html-snippet
-
$html .= $image['img'] . ' ';
-
// add alternate text (if not set, then set to an empty string
-
if (!
isset($image['alt']))
-
$image['alt'] = '';
-
$html .= "alt='{$image['alt']}' ";
-
// add title (only if given)
-
if (isset($image['title']))
-
$html .= "title='{$image['title']}' ";
-
// add showHide
-
$html .= "onClick='showHideForm("{$image['file']}")'";
-
$html .= '/>';
-
} elseif (FALSE !==
$link and
isset($link['name'])) {
-
// this will be the link text, if no image is given
-
$html .= $link['name'];
-
}
-
-
// ---- $link code
-
if (FALSE !==
$link and
isset($link['name'])) {
-
// add it around the already existing code
-
if (!
isset($link['title']))
-
$link['title'] = '';
-
$html = "<a href='" . $abs_path
-
-
. " title='{$link['title']}'>"
-
. $html . '</a>';
-
}
-
-
return $html;
こんばんは。
私もIImage-browserを使っているので、達人でもなんでもないですが、ソースを見てみました。
上記のコードは画像一覧を表示する部分のようで、コードを生成する部分は151行目あたりのswitch(selectedRadio)…からみたいですね。
htmlCode =となっている部分に、” class=”image”"を追加すればOKのようです。thumbを例にすると、
case “thumb”:
htmlCode = “”;
こんな感じですね。
任意のclass名を入力できるようにすることもできましたが、こちらはしばしお待ち下さい。
肝心のコードの部分が消えてしまいました。
下記URLに変更部分のテキストを用意したので、ごらん下さい。
http://bless.babyblue.jp/wp/files/IImage.txt
変更箇所は152~160です。