Esempio n. 1
0
        public bool isVideo()
        {
            S3Url = S3Url.Trim();
            var    S3Path = HttpContext.Current.Server.MapPath("/Upload/" + S3Url);
            String theExt = Path.GetExtension(S3Path);

            switch (theExt)
            {
            case ".mp4":
            case ".flv":
                return(true);
            }
            return(false);
        }
Esempio n. 2
0
        public String getThumbnail()
        {
            //if the thumbnail does not exist on FileSystem
            //then create it
            S3Url = S3Url.Trim();
            var    S3Path  = HttpContext.Current.Server.MapPath("/Upload/" + S3Url);
            String HTTPURL = "https://exponent-s3.s3.amazonaws.com/" + S3Url;
            String theExt  = Path.GetExtension(S3Path);

            switch (theExt)
            {
            case ".jpg":
            case ".jpeg":
            case ".gif":
            case ".png":
                string AppPath = Path.GetDirectoryName(S3Path);
                if (!File.Exists(S3Path))
                {
                    if (!Directory.Exists(AppPath))
                    {
                        Directory.CreateDirectory(AppPath);
                    }
                    Image image = getImageFromURL(HTTPURL);
                    Image thumb = image.GetThumbnailImage(120, 120, () => false, IntPtr.Zero);
                    thumb.Save(S3Path);
                }
                HTTPURL = "/Upload/" + S3Url;
                break;

            case ".aac":
            case ".ai":
            case ".aiff":
            case ".avi":
            case ".bmp":
            case ".c":
            case ".cpp":
            case ".css":
            case ".dat":
            case ".dmg":
            case ".doc":
            case ".dotx":
            case ".dwg":
            case ".dxf":
            case ".eps":
            case ".exe":
            case ".flv":
            case ".h":
            case ".hpp":
            case ".html":
            case ".ics":
            case ".iso":
            case ".java":
            case ".js":
            case ".key":
            case ".less":
            case ".mid":
            case ".mp3":
            case ".mp4":
            case ".mpg":
            case ".odf":
            case ".ods":
            case ".odt":
            case ".otp":
            case ".ots":
            case ".ott":
            case ".pdf":
            case ".php":
            case ".ppt":
            case ".psd":
            case ".py":
            case ".qt":
            case ".rar":
            case ".rb":
            case ".rtf":
            case ".sass":
            case ".scss":
            case ".sql":
            case ".tga":
            case ".tgz":
            case ".tiff":
            case ".txt":
            case ".wav":
            case ".xls":
            case ".xlsx":
            case ".xml":
            case ".yml":
            case ".zip":
                HTTPURL = "/images/512px/" + theExt.Substring(1) + ".png";
                break;

            default:
                HTTPURL = "/images/512px/_page.png";
                break;
            }//switch (theExt)

            return(HTTPURL);
        }