public bool CreateImagePreview(string mediaId)
        {
            bool   result           = false;
            string photoNamePreview = ImagePathManager.GetMediaFilename(mediaId, MediaObjectTypeEnum.Image, true);
            string pathToOriginal   = ImagePathManager.GetImagePath(mediaId, MediaObjectTypeEnum.Image, false);
            string pathToPreview    = ImagePathManager.GetImagePath(mediaId, MediaObjectTypeEnum.Image, true);

            try
            {
                byte[] originalByteArray = readFileToByteArray(pathToOriginal);
                if (originalByteArray.Length > 0)
                {
                    ImagePreviewManager previewManager = new ImagePreviewManager();
                    var    mediaService        = DependencyService.Get <IMediaService>();
                    byte[] imgPreviewByteArray = previewManager.GetPreviewImage(mediaService, originalByteArray, _width, _height, _quality);
                    File.WriteAllBytes(pathToPreview, imgPreviewByteArray);
                    result = true;
                }
            }
            catch (Exception e)
            {
                Crashes.TrackError(e, new Dictionary <string, string> {
                    { "MediaId", "ImgPreview" }, { mediaId, photoNamePreview }
                });
            }

            return(result);
        }
        public bool CreateImagePreview(string pathToOriginalDirectory, string originalFileName, string pathToPreviewDirectory, string previewFileName)
        {
            bool result = false;

            try
            {
                byte[] originalByteArray = readFileToByteArray(Path.Combine(pathToOriginalDirectory, originalFileName));
                if (originalByteArray.Length > 0)
                {
                    ImagePreviewManager previewManager = new ImagePreviewManager();
                    var    mediaService        = DependencyService.Get <IMediaService>();
                    byte[] imgPreviewByteArray = previewManager.GetPreviewImage(mediaService, originalByteArray, _width, _height, _quality);
                    File.WriteAllBytes(pathToPreviewDirectory + "/" + previewFileName, imgPreviewByteArray);
                    imgPreviewByteArray = null;
                    result = true;
                }
            }
            catch (Exception e)
            {
                Crashes.TrackError(e, new Dictionary <string, string> {
                    { "Img", "ImgPreview" }, { originalFileName, previewFileName }
                });
            }

            return(result);
        }