[mir-coders] QUESTION: How to check the multimedia resources stored in a mir installation's database?
briks at riseup.net
Mon Sep 6 15:58:08 PDT 2010
On 09/06/2010 11:38 PM, Txopi wrote:
> If this is right, the check of the multimedia resources i was planning
> to do can't be done because the information isn't in the database.
A basic way to check some consistency between database and file system
could be to compare the size attribute that is stored in the database
with the file's real size:
de_indy_07=# select publish_path,size,to_media_type from uploaded_media
where to_media_type in (3) limit 3;
publish_path | size | to_media_type
/2005/02/106908.ogg | 3375725 | 3
/2004/03/76040.ogg | 645981 | 3
/2004/03/76038.ogg | 3150263 | 3
$ ls -la site/media/2005/02/106908.ogg
-rwxrwxr-x 1 tomcat55 mir 3375725 Feb 13 2005 site/media/2005/02/106908.ogg
(But the image sizes in the database are empty if they are stored as blobs.)
Regarding your question in IRC:
When opening an image in the admin interface the MediaHandler for the
corresponding media type determines how the data is fetched. As I
unterstand it, it works this way:
- For most uploaded medias in MediaHandlerGeneric.java the getMedia
method opens the file from the file system.
- For images (if storing the blobs in the database is used, which is the
default) in MediaHandlerImages.java getMedia gets the data from the
Image entity (which is the data stored in the database as blob).
- If MediaHandlerImagesExtern.java is used (storing images in file
system instead of within the database), the getMedia method from
MediaHandlerGeneric is used.
- The difference between the getThumbnail methods is similar.
The inheritance structure is not exactly how one would expect it from
the classes names:
MediaHandlerGeneric extends AbstractMediaHandler
MediaHandlerImages extends AbstractMediaHandler
MediaHandlerImagesExtern extends MediaHandlerGeneric
More information about the mir-coders