I see it’s possible to create custom file types. I may need this ability for an experiment here in the lab. One thing I was looking at is the Person type. In using the People application, I’m able to drop a picture of myself to my Person file. Is this picture stored as an attribute? If this is true, can someone give me an explanation on how to add a picture (< 32K - small) to a file’s attribute? When creating a file type, is there a way to specify a picture attribute? How does this Person type work??
In the case of the people app, the picture is saved as the file data, all the person “data” is stored as file attributes. once the person has a picture associated with it, it can be opened with any app that can open a graphic file.
one can add a graphic as a raw attribute:
addattr -f graphic.jpg -t raw myattribute filename
note:
Currently, if a file has more than 64kib of attribute data, zip cannot preserve the attribute data. This is a known bug.
you may want to consider doing it like People files, as bbjimmy explained, i.e. write a normal image file (PNG, JPG, whatever) and add further data as attributes. Because once you added the image as attribute, you can’t easily open it. At least there’s no app coming with Haiku that is able to open images stashed away in attributes.
So you’d have to extract the image like this:
What he is doing is creating a website from text files, but the interesting part is in the programmatic creation of a new filetype (as opposed to doing it through the GUI). If you can get hold of a copy of Hacker’s book The BeOS Bible it is all described in great detail there. I see old copies on Amazon occasionally.
As bbjimmy shows above, attributes are not really meant to store huge amounts of data.