mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
Merged revisions 47721 via svnmerge from
svn://svn.silverstripe.com/silverstripe/modules/sapphire/branches/2.2.0-mesq ........ r47721 | ischommer | 2008-01-08 15:58:39 +1300 (Tue, 08 Jan 2008) | 1 line formatting, syncing logic with FileField ........ git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@52402 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
ddda1dcbb8
commit
e27513f11e
@ -22,16 +22,35 @@ class SimpleImageField extends FileField {
|
|||||||
$imageField = "";
|
$imageField = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
$field = "<div class=\"simpleimage\">";
|
$html = "<div class=\"simpleimage\">";
|
||||||
$field .= $this->createTag("input", array("type" => "file", "name" => $this->name)) . $this->createTag("input", array("type" => "hidden", "name" => "MAX_FILE_SIZE", "value" => 30*1024*1024));
|
$html .= $this->createTag("input",
|
||||||
if($imageField && $imageField->exists()) {
|
array(
|
||||||
if($imageField->hasMethod('Thumbnail') && $imageField->Thumbnail()) $field .= "<img src=\"".$imageField->Thumbnail()->URL()."\" />";
|
"type" => "file",
|
||||||
else if($imageField->CMSThumbnail()) $field .= "<img src=\"".$imageField->CMSThumbnail()->URL()."\" />";
|
"name" => $this->name,
|
||||||
else {} // This shouldn't be called but it sometimes is for some reason, so we don't do anything
|
"id" => $this->id(),
|
||||||
}
|
"tabindex" => $this->getTabIndex()
|
||||||
$field .= "</div>";
|
)
|
||||||
|
) .
|
||||||
|
$html .= $this->createTag("input",
|
||||||
|
array(
|
||||||
|
"type" => "hidden",
|
||||||
|
"name" => "MAX_FILE_SIZE",
|
||||||
|
"value" => $this->getAllowedMaxFileSize(),
|
||||||
|
"tabindex" => $this->getTabIndex()
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
return $field;
|
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>";
|
||||||
|
|
||||||
|
return $html;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user