simple question I think.

G

Guest

Hello,
I was having a problem saveing images that I edited with a vb.net
program. Every time I would save the image I would receive a GDI+ error. I
tried everything that I could think of including copying the photo album to
my local drive and I still kept getting the errors. Finally I tried copying
out only the folder that contained the images that I wanted to update and
everyting worked great. Here is the question. How man levels down can you
save a file in a directory? When I tried to save the file 5 levels down I
received an error. This could cause a problem because the photo album is
being used by legacy apps, and I can not change the structure of the album,
unless I want to change a couple of RPG programs (which I do NOT want to do).
Is there any way around this?

ex) c:/level2/level3/level4/level5/image.jpg ---> doesn't work

c:/level2/level3/image.jpg ---> works
 
B

Bernie Yaeger

Hi Brian,

There should be no restrictions.

Can we see your code?

Bernie Yaeger
 
G

Guest

Here is an example
bmpImage.Save("C:\photos\00\00\" & x2 & "\0000" & x2 & y2 & ".jpg")
bmpImage.Save("C:\00\" & x2 & "\0000" & x2 & y2 & ".jpg")

The first line with 2 extra directories fails with a GDI error and the
second one works. If there is no directory issue, I am stumped. I can read
from the first one, but not save to. The second one is just a copy of the
"00" folder put in the C drive.

Any ideas?
 
H

Herfried K. Wagner [MVP]

Brian said:
I was having a problem saveing images that I edited with
a vb.net program. Every time I would save the image I
would receive a GDI+ error.
[...]
ex) c:/level2/level3/level4/level5/image.jpg ---> doesn't work

c:/level2/level3/image.jpg ---> works

Are you really using "/"? Replace them with "\". If this doesn't help:
Are you sure, the directories exist?
 
L

Larry Serflaten

Brian said:
Here is an example
bmpImage.Save("C:\photos\00\00\" & x2 & "\0000" & x2 & y2 & ".jpg")
bmpImage.Save("C:\00\" & x2 & "\0000" & x2 & y2 & ".jpg")

The first line with 2 extra directories fails with a GDI error and the
second one works. If there is no directory issue, I am stumped. I can read
from the first one, but not save to. The second one is just a copy of the
"00" folder put in the C drive.

Any ideas?

Verify that you you have write access to the folder and if all else fails,
try setting the working drive and directory to the one you want and
save the file by just using its name. (See ChDrive and ChDir to change
the current drive and directory).

LFS
 
G

Guest

Nope, sorry. My fingers just got ahead of the brain. I am using \.

Herfried K. Wagner said:
Brian said:
I was having a problem saveing images that I edited with
a vb.net program. Every time I would save the image I
would receive a GDI+ error.
[...]
ex) c:/level2/level3/level4/level5/image.jpg ---> doesn't work

c:/level2/level3/image.jpg ---> works

Are you really using "/"? Replace them with "\". If this doesn't help:
Are you sure, the directories exist?
 
G

Guest

Brian,
I had a very similar problem to what you are having. What I cam up with was
2 differenct fixes, one for VB and one for C#. What I had to do in VB to get
things to work (I have 7 levels of directories) is to assemble the path in a
string before the actual function call, and then put the sting in the
function -- I know, extra line of code, but it worked for me. With C# I had
to add the "@" before the string showing it was a constant string and then
add the file name after. Took 1 more line of code than the VB answer. I
don't know why it didn't work in the function, but once the path and file
name were assembled out of the function in a string variable, things were
fine.

Brian said:
Nope, sorry. My fingers just got ahead of the brain. I am using \.

Herfried K. Wagner said:
Brian said:
I was having a problem saveing images that I edited with
a vb.net program. Every time I would save the image I
would receive a GDI+ error.
[...]
ex) c:/level2/level3/level4/level5/image.jpg ---> doesn't work

c:/level2/level3/image.jpg ---> works

Are you really using "/"? Replace them with "\". If this doesn't help:
Are you sure, the directories exist?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top