ENHANCEMENT Showing image thumb before input field in a separate block <div class="thumbnail"> in SimpleImageField

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@64238 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Ingo Schommer 2008-10-14 21:46:52 +00:00
parent 6feab01a6f
commit d5a37d40dd

View File

@ -33,6 +33,15 @@ class SimpleImageField extends FileField {
} }
$html = "<div class=\"simpleimage\">"; $html = "<div class=\"simpleimage\">";
if($imageField && $imageField->exists()) {
$html .= '<div class="thumbnail">';
if($imageField->hasMethod('Thumbnail') && $imageField->Thumbnail()) {
$html .= "<img src=\"".$imageField->Thumbnail()->URL()."\" />";
} else if($imageField->CMSThumbnail()) {
$html .= "<img src=\"".$imageField->CMSThumbnail()->URL()."\" />";
}
$html .= '</div>';
}
$html .= $this->createTag("input", $html .= $this->createTag("input",
array( array(
"type" => "file", "type" => "file",
@ -49,15 +58,6 @@ class SimpleImageField extends FileField {
"tabindex" => $this->getTabIndex() "tabindex" => $this->getTabIndex()
) )
); );
if($imageField && $imageField->exists()) {
if($imageField->hasMethod('Thumbnail') && $imageField->Thumbnail()) {
$html .= "<img src=\"".$imageField->Thumbnail()->URL()."\" />";
} else if($imageField->CMSThumbnail()) {
$html .= "<img src=\"".$imageField->CMSThumbnail()->URL()."\" />";
}
}
$html .= "</div>"; $html .= "</div>";
return $html; return $html;