• 0

[C#] Store images in a single file?


Question

Hey guys, I'm trying to think of a neat way of doing this.. is it possible to create a single file to store thumbnail images in (about 4kb each I spose) + a filename.. and I spose size as well so I can match them with their source. So basically thumbs.db. :) (except the thumbs.db may not be there and images at wrong sizes.. etc) Read speed is important, writing, not so much. And I spose it would be nice if it wasn't a nightmare to add / remove stuff. :)

I spose another solution is to have a separate folder filled with thumbnails and then just make a text file which says this file belongs to this thumb... but thats not great as I had hoped this file could be read via the network.

Anyone? :\ MS must do it somehow. :(

Edited by Pc_Madness
Link to comment
Share on other sites

10 answers to this question

Recommended Posts

  • 0

Well, what use would this be to you?

You could write a binary file, as long as you know where one item ends and another begins etc. You could also zip things up....

Link to comment
Share on other sites

  • 0
Well, what use would this be to you?

You could write a binary file, as long as you know where one item ends and another begins etc. You could also zip things up....

What use? Trying to hide the files so that the user won't notice them in explorer, and other programs won't pick them up either. A hidden folder is an option I spose, but I dunno, binary file might be better. Keeping things neat. I hate when a Mac connects to my network shares and dumps a heap of little meta data files in there.

Cheers. :)

Edited by Pc_Madness
Link to comment
Share on other sites

  • 0

Hidden (or system level hidden) binary files seem the best choice.

If you're willing to work with a custom driver you could make it 'winvisible' as I call it, in which case they would need another app specifically for viewing Windows's 'noexistant' files, or would need to use a mac to see them.

If you browse on a Mac you can find some files/folders you can never see within Windows because this is applied to them.

Unfortuantly I doubt your willing to write a low level file system driver, but just putting it out there.

Link to comment
Share on other sites

  • 0
Hidden (or system level hidden) binary files seem the best choice.

Unfortuantly I doubt your willing to write a low level file system driver, but just putting it out there.

They're just thumbnails, not blue prints for the Whitehouse, so I don't think a system level driver is needed. :p

Link to comment
Share on other sites

  • 0

Then apply both the system and hidden attributes to the binary file and it will not be visible unless the user unchecks "Hide protected operating system files" in folder options.

Link to comment
Share on other sites

  • 0

How about class serialization? You can make a class of picture objects along with a name and file size.

class MyPicture : ISerializable
{
	string fileName;
	Image picture;
	long fileSize;
}

Store them in a vector:

Vector<MyPicture> vecPics = new Vector<MyPicture>();

And then serialize the vector to disk.

A good example can be found here.

Link to comment
Share on other sites

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.