Skip to content

Commit e24f91b

Browse files
Send manipulated images to temp media directory (#874)
* 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
1 parent a97a90a commit e24f91b

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

dotnet/src/dotnetframework/GxClasses/Core/GXUtilsCommon.cs

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5782,7 +5782,7 @@ private static Bitmap BitmapCreateFromStream(string filePathOrUrl)
57825782
{
57835783
try
57845784
{
5785-
byte[] data = httpClient.GetByteArrayAsync(filePathOrUrl).Result;
5785+
byte[] data = httpClient.GetByteArrayAsync(uri).Result;
57865786
using (MemoryStream mem = new MemoryStream(data))
57875787
{
57885788
return new Bitmap(mem);
@@ -5814,7 +5814,7 @@ private static Image ImageCreateFromStream(string filePathOrUrl)
58145814
{
58155815
try
58165816
{
5817-
byte[] data = httpClient.GetByteArrayAsync(filePathOrUrl).Result;
5817+
byte[] data = httpClient.GetByteArrayAsync(uri).Result;
58185818
using (MemoryStream mem = new MemoryStream(data))
58195819
{
58205820
return Image.FromStream(mem);
@@ -6077,12 +6077,15 @@ public static string Save(Image bitmap, string imageFile, ImageFormat format)
60776077
Uri uri = new Uri(imageFile);
60786078
imageFile = Path.GetFileName(uri.AbsolutePath);
60796079
}
6080-
GxFile sourceImage = new GxFile(GxContext.StaticPhysicalPath(), imageFile);
6081-
string destinationImageName = FileUtil.getTempFileName(sourceImage.GetDirectory().GetAbsoluteName(), Path.GetFileNameWithoutExtension(sourceImage.GetName()), sourceImage.GetExtension());
6082-
GxFile destinationImage = new GxFile(GxContext.StaticPhysicalPath(), destinationImageName);
6080+
string destinationImageName = FileUtil.getTempFileName(
6081+
"",
6082+
Path.GetFileNameWithoutExtension(imageFile),
6083+
Path.GetExtension(imageFile).TrimStart('.')
6084+
);
6085+
GxFile destinationImage = new GxFile(Preferences.getTMP_MEDIA_PATH(), destinationImageName, GxFileType.PrivateAttribute);
60836086
destinationImage.Create(ms);
60846087
destinationImage.Close();
6085-
destinationImagePath = destinationImage.GetAbsoluteName();
6088+
destinationImagePath = destinationImage.GetURI();
60866089
}
60876090
catch (Exception ex)
60886091
{

0 commit comments

Comments
 (0)