Skip to content

Commit

Permalink
Send manipulated images to temp media directory (#874)
Browse files Browse the repository at this point in the history
* Send manipulated images to temp media directory
Issue: 104803

* Remove debugger call and use temp media path as gxfile destination

* Manipulated image wasn't being created in external storage
  • Loading branch information
tomas-sexenian authored Nov 13, 2023
1 parent a97a90a commit e24f91b
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions dotnet/src/dotnetframework/GxClasses/Core/GXUtilsCommon.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5782,7 +5782,7 @@ private static Bitmap BitmapCreateFromStream(string filePathOrUrl)
{
try
{
byte[] data = httpClient.GetByteArrayAsync(filePathOrUrl).Result;
byte[] data = httpClient.GetByteArrayAsync(uri).Result;
using (MemoryStream mem = new MemoryStream(data))
{
return new Bitmap(mem);
Expand Down Expand Up @@ -5814,7 +5814,7 @@ private static Image ImageCreateFromStream(string filePathOrUrl)
{
try
{
byte[] data = httpClient.GetByteArrayAsync(filePathOrUrl).Result;
byte[] data = httpClient.GetByteArrayAsync(uri).Result;
using (MemoryStream mem = new MemoryStream(data))
{
return Image.FromStream(mem);
Expand Down Expand Up @@ -6077,12 +6077,15 @@ public static string Save(Image bitmap, string imageFile, ImageFormat format)
Uri uri = new Uri(imageFile);
imageFile = Path.GetFileName(uri.AbsolutePath);
}
GxFile sourceImage = new GxFile(GxContext.StaticPhysicalPath(), imageFile);
string destinationImageName = FileUtil.getTempFileName(sourceImage.GetDirectory().GetAbsoluteName(), Path.GetFileNameWithoutExtension(sourceImage.GetName()), sourceImage.GetExtension());
GxFile destinationImage = new GxFile(GxContext.StaticPhysicalPath(), destinationImageName);
string destinationImageName = FileUtil.getTempFileName(
"",
Path.GetFileNameWithoutExtension(imageFile),
Path.GetExtension(imageFile).TrimStart('.')
);
GxFile destinationImage = new GxFile(Preferences.getTMP_MEDIA_PATH(), destinationImageName, GxFileType.PrivateAttribute);
destinationImage.Create(ms);
destinationImage.Close();
destinationImagePath = destinationImage.GetAbsoluteName();
destinationImagePath = destinationImage.GetURI();
}
catch (Exception ex)
{
Expand Down

0 comments on commit e24f91b

Please sign in to comment.