Mailing List Archive

mime type
Hi,

I'd like to add a list of related media other than images.
pdf, doc and things that users may have attached to a story.
I wonder how can I check mime type of a media, file size, etc.

Regards, Zdravko
Re: mime type [ In reply to ]
On Oct 20, 2009, at 6:04 AM, Zdravko Balorda wrote:

> I'd like to add a list of related media other than images.
> pdf, doc and things that users may have attached to a story.
> I wonder how can I check mime type of a media, file size, etc.

At this time, related media elements do not have a constraint on the
type of file that can be uploaded. The best you can do is check the
media type in your templates and throw an exception on preview,
something like this:

unless ($image) {
$burner->throw_error(
'There is no image associated! Associate an image or delete
this related_media item'
) if $burner->get_mode == PREVIEW_MODE;
return;
}

# This template only handles images.
unless ($image->get_media_type->get_name =~ /^image\b/ ) {
$burner->throw_error(
'This is not an image! You should only upload an image.'
) if $burner->get_mode == PREVIEW_MODE;
return;
}

Best,

David
Re: mime type [ In reply to ]
> # This template only handles images.
> unless ($image->get_media_type->get_name =~ /^image\b/ ) {

David, tahnk you, this was just the pointer I needed.
Since I can add my own description to MIME types the
list of enclosures looks really neat.

Regards, Zdravko.
Re: mime type [ In reply to ]
David,
while at it, there is a media ending in .WAV
that is not recognized. My blind guess is that
only .wav works, not .WAV, but when I try to add
new name ending (WAV) it doesn't get saved.
This is 1.10.4. Is it a known bug?

Regards, Zdravko
Re: mime type [ In reply to ]
This was fixed in 1.10.7. It's a small one line fix you can try
applying to 1.10.4 if you aren't looking to upgrade yet:

http://github.com/bricoleurs/bricolage/commit/c85dc9b5ad204e8ed3c97ad71fd751a89017a3d3


--Greg

On 21 Oct 2009, at 10:08 AM, Zdravko Balorda wrote:

> David,
> while at it, there is a media ending in .WAV
> that is not recognized. My blind guess is that
> only .wav works, not .WAV, but when I try to add
> new name ending (WAV) it doesn't get saved.
> This is 1.10.4. Is it a known bug?
>
> Regards, Zdravko
>
>