修改BUG:个人中心页面初始化时获得用户头像大小
This commit is contained in:
parent
8354b86aa1
commit
7480e821c3
|
@ -1,8 +1,5 @@
|
||||||
using Bootstrap.DataAccess;
|
using Microsoft.AspNetCore.Hosting;
|
||||||
using Bootstrap.Security;
|
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
|
||||||
namespace Bootstrap.Admin.Models
|
namespace Bootstrap.Admin.Models
|
||||||
|
@ -22,8 +19,9 @@ namespace Bootstrap.Admin.Models
|
||||||
/// <param name="controller"></param>
|
/// <param name="controller"></param>
|
||||||
public ProfilesModel(ControllerBase controller) : base(controller)
|
public ProfilesModel(ControllerBase controller) : base(controller)
|
||||||
{
|
{
|
||||||
// TODO: 找到MapPath方法
|
var host = controller.HttpContext.RequestServices.GetService(typeof(IHostingEnvironment)) as IHostingEnvironment;
|
||||||
var fileName = AppContext.BaseDirectory + Icon;
|
if (host == null) return;
|
||||||
|
var fileName = Path.Combine(host.WebRootPath, Icon.TrimStart('~', '/').Replace('/', '\\'));
|
||||||
if (File.Exists(fileName))
|
if (File.Exists(fileName))
|
||||||
{
|
{
|
||||||
Size = new FileInfo(fileName).Length;
|
Size = new FileInfo(fileName).Length;
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
preIcon
|
preIcon
|
||||||
],
|
],
|
||||||
initialPreviewConfig: [
|
initialPreviewConfig: [
|
||||||
{ caption: "现在头像", size: $('#fileIcon').attr('data-init'), showZoom: true },
|
{ caption: "现在头像", size: $('#fileIcon').attr('data-init'), showZoom: true }
|
||||||
],
|
],
|
||||||
initialPreviewAsData: true,
|
initialPreviewAsData: true,
|
||||||
overwriteInitial: true,
|
overwriteInitial: true,
|
||||||
|
|
Loading…
Reference in New Issue