Re: Accessing file extended properties in .NET

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



On Dec 5, 12:43 pm, "Jeff Johnson" <i....@xxxxxxxxxxx> wrote:
"daveh551" <gee...@xxxxxxxxx> wrote in message

news:2c2ff214-ec84-405d-ad79-ed72484cf65e@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Now, for my question: I have searched and searched and searched all
the help files and forums and other documentation I can think of for
some managed code (.NET) equivalent to this functionality without
resorting to creating an unmanaged object to invoke the shell
scripting engine, and I have not been successful. Surely something
this basic is available somehow?
Does anyone know how to do this in C#?
http://www.codeproject.com/KB/cs/ntfsstreams.aspx
Jeff,
That was a very interesting article, but I built his code and ran it
against a jpg file and it returned no alternate streams, so that won't
help in this case.

You can't count on this to work for everything. Office documents store their
properties inside them in OLE Document storage, not in streams. MP3s use ID3
tags, not streams. JPGs may used what are called EXIF tags, but I'm not
positive. Even if they don't, it's possible that Windows Explorer can report
a JPG's dimensions by simply examining the file and not because the data is
stored explicitly. So I guess you should tell us exactly what you're trying
to do.

Exactly what I'm trying to do is write a function that, as quickly and
efficiently as possible, given a jpg file path, will return the pixel
dimensions:

struct size { int x, int y};
size GetDimensions(string jpgPath);

Actually, more specifically what I want is the aspect ratio. I want
to set the height and width parameters for an HTML <img> tag such that
the displayed image fits within the allotted space, but maintains the
aspect ratio of the original file.

I know I can do it by loading the file into some sort of image object
and getting the dimensions from the image, but I do not want to read
in the whole file, since I'm going to turn around and hand it off to
IIS which will then read it again.

And I don't believe that the OS is reading the JPEG file each time it
displays those attributes when you hover your mouse over the
thumbnail. I once thought they might be stored in the thumbs.db, but
I removed that and set options to keep it from being regenerated, and
the dimensions are still displayed.
.



Relevant Pages

  • Re: Great SWT Program
    ... Not "without reading any documentation", ... If there's no hint in the UI that given functionality exists, ... you can just hit enter to launch the search. ... The puppy will ...
    (comp.lang.java.programmer)
  • Re: Msoft wireless keyboards - need help please
    ... > Here is where the documentation was supposed to be: ... > Ron Shaw wrote: ... >> actually look at microsuxs wireless keyboards ... i dont see where msux gives any dimensions ...
    (microsoft.public.windowsxp.hardware)
  • Re: Waitable Time Support
    ... On Oct 29, 9:01 pm, "Christopher Fairbairn" ... *can* use WaitForMultiple on those system events. ... This functionality is a little hidden... ... suggested the documentation tends to suggest the only way it works is to ...
    (microsoft.public.pocketpc.developer)
  • Re: Linux API developer documentation
    ... >> Where does one normally find the documentation to the core functions ... >> of the Linux API? ... general documentation other than the libc documentation about the kernel ... Sorry to be comparing the Linux core functionality to ...
    (alt.os.linux)
  • Re: What are the Missing Parts in the CVF Windows API?
    ... Both the documentation and third-party books say that **almost** ... | all of the full functionality of the Windows API, ...
    (comp.lang.fortran)