Uses just the fix from #6414 - to show a preview of svg files after selection in the media picker
This commit is contained in:
@@ -143,23 +143,28 @@ function mediaHelper(umbRequestHelper, $log) {
|
||||
*/
|
||||
resolveFileFromEntity: function (mediaEntity, thumbnail) {
|
||||
|
||||
if (!angular.isObject(mediaEntity.metaData) || !mediaEntity.metaData.MediaPath) {
|
||||
var mediaPath = angular.isObject(mediaEntity.metaData) ? mediaEntity.metaData.MediaPath : null;
|
||||
|
||||
if (!mediaPath) {
|
||||
//don't throw since this image legitimately might not contain a media path, but output a warning
|
||||
$log.warn("Cannot resolve the file url from the mediaEntity, it does not contain the required metaData");
|
||||
return null;
|
||||
}
|
||||
|
||||
if (thumbnail) {
|
||||
if (this.detectIfImageByExtension(mediaEntity.metaData.MediaPath)) {
|
||||
return this.getThumbnailFromPath(mediaEntity.metaData.MediaPath);
|
||||
if (this.detectIfImageByExtension(mediaPath)) {
|
||||
return this.getThumbnailFromPath(mediaPath);
|
||||
}
|
||||
else if (this.getFileExtension(mediaPath) === "svg") {
|
||||
return this.getThumbnailFromPath(mediaPath);
|
||||
}
|
||||
else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
else {
|
||||
return mediaEntity.metaData.MediaPath;
|
||||
}
|
||||
return mediaPath;
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -294,6 +299,11 @@ function mediaHelper(umbRequestHelper, $log) {
|
||||
*/
|
||||
getThumbnailFromPath: function (imagePath) {
|
||||
|
||||
// Check if file is a svg
|
||||
if (this.getFileExtension(imagePath) === "svg") {
|
||||
return imagePath;
|
||||
}
|
||||
|
||||
//If the path is not an image we cannot get a thumb
|
||||
if (!this.detectIfImageByExtension(imagePath)) {
|
||||
return null;
|
||||
|
||||
Reference in New Issue
Block a user