mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-15 19:54:57 +08:00
Added thumbnails for pictures in media folder view.
--HG-- branch : 1.x
This commit is contained in:
@@ -252,7 +252,7 @@ namespace Orchard.Media.Controllers {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public ActionResult EditMedia(MediaItemEditViewModel model) {
|
public ActionResult EditMedia(MediaItemEditViewModel model) {
|
||||||
model.PublicUrl = _mediaService.GetPublicUrl(Path.Combine(model.MediaPath, model.Name));
|
model.PublicUrl = _mediaService.GetMediaPublicUrl(model.MediaPath, model.Name);
|
||||||
return View(model);
|
return View(model);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -8,5 +8,6 @@ namespace Orchard.Media.Models {
|
|||||||
public long Size { get; set; }
|
public long Size { get; set; }
|
||||||
public string FolderName { get; set; }
|
public string FolderName { get; set; }
|
||||||
public DateTime LastUpdated { get; set; }
|
public DateTime LastUpdated { get; set; }
|
||||||
|
public string MediaPath { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -16,6 +16,14 @@ namespace Orchard.Media.Services {
|
|||||||
/// <returns>The public path relative to the application url.</returns>
|
/// <returns>The public path relative to the application url.</returns>
|
||||||
string GetPublicUrl(string relativePath);
|
string GetPublicUrl(string relativePath);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns the public URL for a media file.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="mediaPath">The relative path of the media folder containing the media.</param>
|
||||||
|
/// <param name="fileName">The media file name.</param>
|
||||||
|
/// <returns>The public URL for the media.</returns>
|
||||||
|
string GetMediaPublicUrl(string mediaPath, string fileName);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Retrieves the media folders within a given relative path.
|
/// Retrieves the media folders within a given relative path.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@@ -50,7 +50,17 @@ namespace Orchard.Media.Services {
|
|||||||
Argument.ThrowIfNullOrEmpty(relativePath, "relativePath");
|
Argument.ThrowIfNullOrEmpty(relativePath, "relativePath");
|
||||||
|
|
||||||
return _storageProvider.GetPublicUrl(relativePath);
|
return _storageProvider.GetPublicUrl(relativePath);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns the public URL for a media file.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="mediaPath">The relative path of the media folder containing the media.</param>
|
||||||
|
/// <param name="fileName">The media file name.</param>
|
||||||
|
/// <returns>The public URL for the media.</returns>
|
||||||
|
public string GetMediaPublicUrl(string mediaPath, string fileName) {
|
||||||
|
return GetPublicUrl(Path.Combine(mediaPath, fileName));
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Retrieves the media folders within a given relative path.
|
/// Retrieves the media folders within a given relative path.
|
||||||
@@ -79,7 +89,8 @@ namespace Orchard.Media.Services {
|
|||||||
Size = file.GetSize(),
|
Size = file.GetSize(),
|
||||||
LastUpdated = file.GetLastUpdated(),
|
LastUpdated = file.GetLastUpdated(),
|
||||||
Type = file.GetFileType(),
|
Type = file.GetFileType(),
|
||||||
FolderName = relativePath
|
FolderName = relativePath,
|
||||||
|
MediaPath = GetMediaPublicUrl(relativePath, file.GetName())
|
||||||
}).ToList();
|
}).ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -9,4 +9,10 @@
|
|||||||
.previewImage {
|
.previewImage {
|
||||||
max-height:640px;
|
max-height:640px;
|
||||||
max-width:640px;
|
max-width:640px;
|
||||||
|
}
|
||||||
|
.smallPreviewImage {
|
||||||
|
max-height:64px;
|
||||||
|
max-width:128px;
|
||||||
|
float: left;
|
||||||
|
margin-right: 16px;
|
||||||
}
|
}
|
@@ -68,6 +68,9 @@
|
|||||||
size = mediaFile.Size,
|
size = mediaFile.Size,
|
||||||
folderName = mediaFile.FolderName,
|
folderName = mediaFile.FolderName,
|
||||||
mediaPath = Model.MediaPath })
|
mediaPath = Model.MediaPath })
|
||||||
|
@if (Html.IsPicture(mediaFile.Name)) {
|
||||||
|
<img src="@mediaFile.MediaPath" class="smallPreviewImage" alt="@mediaFile.Name"/>
|
||||||
|
}
|
||||||
</td>
|
</td>
|
||||||
<td>@mediaFile.User</td>
|
<td>@mediaFile.User</td>
|
||||||
<td>@mediaFile.LastUpdated</td>
|
<td>@mediaFile.LastUpdated</td>
|
||||||
|
Reference in New Issue
Block a user