473,507 Members | 2,545 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Getting A generic error occurred in GDI+ message


I have set a file based photo galery. Thumbnails are generated and saved to
disk. Everything was working or so i thought until i found this problem.
When you click a link to go to a gallery everything works fine. But if you
reload that page then you get the dreaded generic error message. To it
happen go to http://riderdesign.com/photos/defaul...EquineRotation
and then reload the page.
My code making the thumbs is this: Any idea whats happening and how to fix
this.?

Thanks
Ashok Padmanabhan

For Each oFile In oFiles

Dim ext As String = oFile.Extension.ToLower

If ext = ".jpg" Or ext = ".gif" And ThumbFile.GetLength(0) <>
oFiles.GetLength(0) Then

Dim FileName As String = oFile.Name.ToLower()

Dim g As System.Drawing.Image

Dim boxWidth As Int32 = 100

Dim boxHeight As Int32 = 100

Dim newHeight, sizer, newWidth As Double

g = System.Drawing.Image.FromFile(PhysPath & "\" & FileName)

If g.Height g.Width Then

sizer = CDbl(boxWidth / g.Height)

Else

sizer = CDbl(boxHeight / g.Width)

End If

newWidth = Convert.ToInt32(g.Width * sizer)

newHeight = Convert.ToInt32(g.Height * sizer)

Dim g2 As New System.Drawing.Bitmap(g, CInt(newWidth), CInt(newHeight))

g.Dispose()

Dim Epars As New EncoderParameters(1)

Dim Ic As ImageCodecInfo

g2.RawFormat.Equals("jpg")

Ic = GetEncoderInfo("image/jpeg")

Epars.Param(0) = New EncoderParameter(Encoder.Quality, 90)

g2.Save(destdir & "/" & Path.GetFileName(FileName), Ic, Epars)

g2.Dispose()

g = Nothing

g2 = Nothing

Else

'do nothing

End If

Next oFile


Sep 25 '06 #1
2 1354
"Showjumper" <dfgkjhdfschrieb:
g2.Save(destdir & "/" & Path.GetFileName(FileName), Ic, Epars)
Use "\" as directory sepator or better use 'System.IO.Path.Combine'.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
Sep 25 '06 #2

Still get the error.
"Herfried K. Wagner [MVP]" <hi***************@gmx.atwrote in message
news:ed**************@TK2MSFTNGP03.phx.gbl...
"Showjumper" <dfgkjhdfschrieb:
>g2.Save(destdir & "/" & Path.GetFileName(FileName), Ic, Epars)

Use "\" as directory sepator or better use 'System.IO.Path.Combine'.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>


Sep 26 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
48183
by: Michael Kennedy [UB] | last post by:
Hi Everyone, I have this multithreaded C# windows forms application which does a lot of image processing. Occasionally, I get the following error: A generic error occurred in GDI+....
1
5608
by: John Hoffman | last post by:
Hello, I need some advice on what a generic error is and how to debug it... Any ideas? System.Runtime.InteropServices.ExternalException: A generic error occurred in GDI+. at...
2
22280
by: Alphonse Giambrone | last post by:
I am currently reading 'Programming The Web with Visual Basic .NET' and have so far found it to be excellent. Downloaded all the code from Apress and working in chapter 4, I get the error shown...
3
5856
by: T. Davis | last post by:
In C#, I am able to successfully stream a TIFF image that comes from a BLOB field in a database, save it to file, then convert the pages within TIFF file into jpegs (using GDI+) and display on the...
0
1181
by: Eduard | last post by:
Hey folks, I'm creating an image gallery Custom Web Control. The idea is, that i point to a folder using the web.config, which makes that folder the 'Image Gallery Folder' Each subfolder created,...
15
5302
by: David Lozzi | last post by:
Howdy, I have a function that uploads an image and that works great. I love ..Nets built in upload, so much easier than 3rd party uploaders! Now I am making a public function that will take the...
0
4233
by: =?Utf-8?B?Sm9hY2hpbQ==?= | last post by:
I have a bitmap which I have retreived through the WebBrowser DrawToBitmap method into a Bitmap. When I try to save the bitmap I get "ExternalException occurred A generic error occurred in...
3
3303
by: uday1302 | last post by:
Hi Dear, Here I am trying to upload a photo. protected void LoadImage() { string UserName = Session.ToString(); byte Data = Profile.GetImageData(UserName);...
0
7223
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7314
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7372
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
5623
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5041
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4702
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3191
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3179
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1540
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.