*Deprecated* This material is for historical purposes only See https://wiki.duraspace.org/display/VIVODOC/All+Documentation for current documentation
*Deprecated* See https://wiki.duraspace.org/display/VIVODOC/All+Documentation for current documentation
See also Where are Images stored in VIVO?, How to access images after changing the default namespace?
Excerpted from an email conversation between Jim Blake and Eliza Chan, dated 2010-10-18 10:15
Eliza;
Perhaps "intractable" is not the right word, but it's close.
When an image file is uploaded via the GUI, the process is something along these lines:
These are no more than a multitude of technical details, except: how do you find an appropriate region of the image to use as the thumbnail?
Generating the thumbnail itself can be quite problematic if the initial image is a GIF or PNG with transparency.
For an individual on my test installation (in N3, if I remember how to write it)
<http://vivo.mydomain.edu/individual/n1451> http://vitro.mannlib.cornell.edu/ns/vitro/public#mainImage http://vivo.mydomain.edu/individual/n1674.
<http://vivo.mydomain.edu/individual/n1674> http://vitro.mannlib.cornell.edu/ns/vitro/public#thumbnailImage http://vivo.mydomain.edu/individual/n5863; http://vitro.mannlib.cornell.edu/ns/vitro/public#downloadLocation http://vivo.mydomain.edu/individual/n3156; http://vitro.mannlib.cornell.edu/ns/vitro/public#mimeType "image/jpeg"; http://vitro.mannlib.cornell.edu/ns/vitro/public#filename "lily1.jpg"; http://vitro.mannlib.cornell.edu/ns/vitro/0.7#modTime "2010-10-18T09:51:58"; http://www.w3.org/1999/02/22-rdf-syntax-ns#type http://vitro.mannlib.cornell.edu/ns/vitro/public#File; http://www.w3.org/1999/02/22-rdf-syntax-ns#type http://www.w3.org/2002/07/owl#Thing.
<http://vivo.mydomain.edu/individual/n3156> http://vitro.mannlib.cornell.edu/ns/vitro/0.7#modTime "2010-10-18T09:51:57"; http://www.w3.org/1999/02/22-rdf-syntax-ns#type http://vitro.mannlib.cornell.edu/ns/vitro/public#FileByteStream; http://www.w3.org/1999/02/22-rdf-syntax-ns#type http://www.w3.org/2002/07/owl#Thing.
<http://vivo.mydomain.edu/individual/n5863> http://vitro.mannlib.cornell.edu/ns/vitro/public#downloadLocation http://vivo.mydomain.edu/individual/n5889; http://vitro.mannlib.cornell.edu/ns/vitro/public#mimeType "image/jpeg"; http://vitro.mannlib.cornell.edu/ns/vitro/public#filename "thumbnail_lily1.jpg"; http://vitro.mannlib.cornell.edu/ns/vitro/0.7#modTime "2010-10-18T09:52:12"; http://www.w3.org/1999/02/22-rdf-syntax-ns#type http://vitro.mannlib.cornell.edu/ns/vitro/public#File; http://www.w3.org/1999/02/22-rdf-syntax-ns#type http://www.w3.org/2002/07/owl#Thing.
<http://vivo.mydomain.edu/individual/n5889> http://vitro.mannlib.cornell.edu/ns/vitro/0.7#modTime "2010-10-18T09:52:12"; http://www.w3.org/1999/02/22-rdf-syntax-ns#type http://vitro.mannlib.cornell.edu/ns/vitro/public#FileByteStream; http://www.w3.org/1999/02/22-rdf-syntax-ns#type http://www.w3.org/2002/07/owl#Thing;
The file system looks something like this:
File storage properties file: /usr/local/vivo/uploads/file_storage_namespace.properties
a = http://vivo.mydomain.edu/individual/
Main image:
/usr/local/vivo/uploads/file_storage_root/a~n/315/6/lily1.jpg
Thumbnail:
/usr/local/vivo/uploads/file_storage_root/a~n/588/9/thumbnail_lily1.jpg
Note: The file storage system does "laundering" on the filenames, in order to allow files with special characters to be stored in a portable manner (e.g., Linux or Windows).
Jim
Excerpted from a message in the vivo-dev-all archive, by Eliza Chan, dated 2010-11-04 16:08
As an experiment tested on localhost, when the pictures were uploaded using a "non-traditional" method, i.e. copying directly to the folder /usr/local/vivo/data/uploads/file_storage_root/a~n, the content under primary tab became blank (see attachment localhost_vivo_mainTab.tiff). Pictures did show up but only when the primary tab content was clicked (see attachment localhost_vivo_tabContent.tiff). The reason for copying directly to the folder was to save the work for doing manual upload of about 1000 photos.
The way it was done was as follows:
1. Create RDF for images and add to the VIVO site, e.g.
<rdf:Description rdf:about="http://localhost:8080/vivo/individual/cwid-gwa2001">
<j.2:mainImage rdf:resource="http://localhost:8080/vivo/individual/mainImage-gwa2001"/>
<rdf:type rdf:resource="http://www.w3.org/2002/07/owl#Thing"/>
<rdf:type rdf:resource="http://xmlns.com/foaf/0.1/Person"/>
<rdf:type rdf:resource="http://vivoweb.org/ontology/core#FacultyMember"/>
<rdf:type rdf:resource="http://xmlns.com/foaf/0.1/Agent"/>
</rdf:Description>
<rdf:Description rdf:about="http://localhost:8080/vivo/individual/mainImage-gwa2001">
<rdf:type rdf:resource="http://www.w3.org/2002/07/owl#Thing"/>
<j.2:downloadLocation rdf:resource="http://localhost:8080/vivo/individual/n1229119954939"/>
<j.2:thumbnailImage rdf:resource="http://localhost:8080/vivo/individual/thumbnailImage-gwa2001"/>
<j.5:modTime xml:lang="en">2010-11-04T10:44:04</j.5:modTime>
<j.2:mimeType xml:lang="en">image/jpeg</j.2:mimeType>
<j.2:filename xml:lang="en">_main_image_gwa2001.jpg</j.2:filename>
<rdf:type rdf:resource="http://vitro.mannlib.cornell.edu/ns/vitro/public#File"/>
</rdf:Description>
<rdf:Description rdf:about="http://localhost:8080/vivo/individual/n1229119954939">
<rdf:type rdf:resource="http://www.w3.org/2002/07/owl#Thing"/>
<j.5:modTime xml:lang="en">2010-11-04T10:44:04</j.5:modTime>
<rdf:type rdf:resource="http://vitro.mannlib.cornell.edu/ns/vitro/public#FileByteStream"/>
</rdf:Description>
<rdf:Description rdf:about="http://localhost:8080/vivo/individual/thumbnailImage-gwa2001">
<rdf:type rdf:resource="http://www.w3.org/2002/07/owl#Thing"/>
<j.2:downloadLocation rdf:resource="http://localhost:8080/vivo/individual/n12291199549391"/>
<j.5:modTime xml:lang="en">2010-11-04T10:44:04</j.5:modTime>
<j.2:mimeType xml:lang="en">image/jpeg</j.2:mimeType>
<j.2:filename xml:lang="en">gwa2001.jpg</j.2:filename>
<rdf:type rdf:resource="http://vitro.mannlib.cornell.edu/ns/vitro/public#File"/>
</rdf:Description>
<rdf:Description rdf:about="http://localhost:8080/vivo/individual/n12291199549391">
<rdf:type rdf:resource="http://www.w3.org/2002/07/owl#Thing"/>
<j.5:modTime xml:lang="en">2010-11-04T10:44:04</j.5:modTime>
<rdf:type rdf:resource="http://vitro.mannlib.cornell.edu/ns/vitro/public#FileByteStream"/>
</rdf:Description>
2. Copy images to the following folders:
/usr/local/vivo/data/uploads/file_storage_root/a~n/122/911/995/493/9/_main_image_gwa2001.jpg
/usr/local/vivo/data/uploads/file_storage_root/a~n/122/911/995/493/91/gwa2001.jpg
You can retrieve an image file by asking for the Individual page of its FileByteStream. For example,
http://localhost:8080/vivo/individual/n4898
VIVO will see that this particular individual is a FileByteStream, and will redirect your browser to the "alias URL" for that image. In this case:
http://localhost:8080/vivo/file/n4898/john_doe.jpg
This redirection means that the image shown in your browser has a name that you will recognize, with an appropriate file type. If you choose "Save Image" in your browser, the default filename will be suitable for the image.
However, this redirection implies additional overhead. Pages local to VIVO calculated the alias URL and used it as the "src" property on the image, avoiding the redirection. But because the "alias URL" was not present in the RDF, it was not available to external applications, which resulted in excessive load times for pages that displayed dozens of images.
In VIVO release 1.2 we added the "directDownloadUrl" property to FileByteStream objects. This property contains the "alias URL", is created when the image is ingested, and is used both by VIVO and by external applications when displaying images.
VIVO releases from 1.2 through 1.4.1 contained code that would analyze the data model at startup, creating this property in the RDF if it was not present. Starting with release 1.5, that code has been removed, and ingested RDF for image files must contain the "directDownloadUrl" property in addition to those described above.
Accordingly, the FileByteStream examples shown above must now look like this instead:
<http://vivo.mydomain.edu/individual/n3156> http://vitro.mannlib.cornell.edu/ns/vitro/0.7#modTime "2010-10-18T09:51:57"; http://www.w3.org/1999/02/22-rdf-syntax-ns#type http://vitro.mannlib.cornell.edu/ns/vitro/public#FileByteStream; http://www.w3.org/1999/02/22-rdf-syntax-ns#type http://www.w3.org/2002/07/owl#Thing. http://vitro.mannlib.cornell.edu/ns/vitro/public#directDownloadUrl "/file/n3156/lily1.jpg"
<http://vivo.mydomain.edu/individual/n5889> http://vitro.mannlib.cornell.edu/ns/vitro/0.7#modTime "2010-10-18T09:52:12"; http://www.w3.org/1999/02/22-rdf-syntax-ns#type http://vitro.mannlib.cornell.edu/ns/vitro/public#FileByteStream; http://www.w3.org/1999/02/22-rdf-syntax-ns#type http://www.w3.org/2002/07/owl#Thing; http://vitro.mannlib.cornell.edu/ns/vitro/public#directDownloadUrl "/file/n5889/thumbnail_lily1.jpg"