mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
BUGFIX: Resized images which return null or false are now ignored
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/branches/2.4@96754 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
2d8951193d
commit
3d92026def
@ -117,17 +117,25 @@ class HtmlEditorField extends TextareaField {
|
|||||||
$width = $img->getAttribute('width');
|
$width = $img->getAttribute('width');
|
||||||
$height = $img->getAttribute('height');
|
$height = $img->getAttribute('height');
|
||||||
|
|
||||||
|
if($image){
|
||||||
if($width && $height && ($width != $image->getWidth() || $height != $image->getHeight())) {
|
if($width && $height && ($width != $image->getWidth() || $height != $image->getHeight())) {
|
||||||
$img->setAttribute('src', $image->ResizedImage($width, $height)->getRelativePath());
|
//Make sure that the resized image actually returns an image:
|
||||||
|
$resized=$image->ResizedImage($width, $height);
|
||||||
|
if($resized)
|
||||||
|
$img->setAttribute('src', $resized->getRelativePath());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add default empty title & alt attributes.
|
// Add default empty title & alt attributes.
|
||||||
if(!$img->getAttribute('alt')) $img->setAttribute('alt', '');
|
if(!$img->getAttribute('alt')) $img->setAttribute('alt', '');
|
||||||
if(!$img->getAttribute('title')) $img->setAttribute('title', '');
|
if(!$img->getAttribute('title')) $img->setAttribute('title', '');
|
||||||
|
|
||||||
|
//If the src attribute is not set, then we won't add this to the list:
|
||||||
|
if($img->getAttribute('src')){
|
||||||
// Add to the tracked files.
|
// Add to the tracked files.
|
||||||
$linkedFiles[] = $image->ID;
|
$linkedFiles[] = $image->ID;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Save file & link tracking data.
|
// Save file & link tracking data.
|
||||||
if($record->ID && $record->many_many('LinkTracking') && $tracker = $record->LinkTracking()) {
|
if($record->ID && $record->many_many('LinkTracking') && $tracker = $record->LinkTracking()) {
|
||||||
|
Loading…
Reference in New Issue
Block a user