namespace PhotoTkutimes.Models
{
    public class DtlImg
    {
        public string ImgNo { get; set; }
        public string PaperNo { get; set; }
        public string ImgChTle { get; set; }
        public string ImgChDes { get; set; }
        public string ImgEngTle { get; set; }
        public string ImgEngDes { get; set; }
        public string ImgPath { get; set; }
        public string ImgNme { get; set; }

        public static string getImgUrl(string path, string sizepath, string fn)
        {
            string url = "https://photo.tkutimes.tku.edu.tw/";
            sizepath = sizepath.ToLower();
            string ashx = "";
            if (sizepath == "l")
            {
                sizepath = "";
                ashx = url + "ashx/srcimg.ashx?im=";
            }
            else if (sizepath == "m")
            {
                sizepath = "m/";
                ashx = url + "ashx/waterimg.ashx?im=";
            }
            else if (sizepath == "f")
            {
                sizepath = "f/";
                ashx = url + "ashx/wimg1020.cshtml?im=";
            }
            else
            {
                sizepath = "s" + "/";
                ashx = url + "ashx/simg.ashx?im=";
            }
            return ashx + new Security().Encrypt(string.Concat("Photos/", path, sizepath, fn));

        }
    }
}
