Mime types

Random stuff about serendipity. Discussion, Questions, Paraphernalia.
Post Reply
lordcoffee
Regular
Posts: 308
Joined: Tue Nov 29, 2005 10:22 pm
Location: Munich - Germany
Contact:

Mime types

Post by lordcoffee »

Hi!

If I upload a .mov file to my mediagallerie it shows me the "mime_unknown.png". Is there a way that s9y recognizes that this file is a mov and if I upload a eg. mov.png to the admin folder that it will take this one?

Thanks,Lordcoffee!
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Mime types

Post by garvinhicking »

Which s9y version are you using?

The file extension '.mov' is listed as "video/x-quicktime" in our MIME recognition code. It might be that the PHP "getimagesize" function is interfering and reporting a mimetype already...

Note that only PDF and images currently have mimetype images.

Support for other mimetypes has not yet been included to s9y; I just committed it into Serendpity 1.1-alpha1, where you can have "admin/img/mime_XXX-YYY.png" images that are used, if they exist.

http://svn.berlios.de/viewcvs/serendipi ... 942&r2=967

Best regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
lordcoffee
Regular
Posts: 308
Joined: Tue Nov 29, 2005 10:22 pm
Location: Munich - Germany
Contact:

Post by lordcoffee »

I now have removed the lines from the svn and uploaded a mime_mov.png but nothing happens. Is the name for the .png wrong?

Lordcoffee
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

Hi!

You must not only remove those lines, you must also add the lines that have been changed! You might need to read a bit about the "patch" format, or you need to upgrade to serendipity 1.1-alpha1.

"mime_mov.png" is wrong, you need to use the mime type of the file. That means you must create a "mime_video-x-quicktime.png" file.

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
lordcoffee
Regular
Posts: 308
Joined: Tue Nov 29, 2005 10:22 pm
Location: Munich - Germany
Contact:

O.K.

Post by lordcoffee »

Of course I've added the lines... :D And it works fine! Thanks.
I'm also using the usergallery event plugin. This one contains the lines:
else {
$image['isimage'] = false;
$image['link'] = serendipity_getTemplateFile('admin/img/mime_unknown.png');
}
What have I to insert there to use the "mime_video-x-quicktime.png" as it works in the adminpanel?

Thanks again!
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: O.K.

Post by garvinhicking »

You could try this:

Code: Select all

$image['link'] = serendipity_getTemplateFile('admin/img/mime_' . preg_replace('@[^0-9a-z_\-]@i', '-', $file['mime']) . '.png');
if (!$image['link']) {
serendipity_getTemplateFile('admin/img/mime_unknown.png');
}
Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
lordcoffee
Regular
Posts: 308
Joined: Tue Nov 29, 2005 10:22 pm
Location: Munich - Germany
Contact:

Post by lordcoffee »

No, this doesn't fix it. Maybe a link will help you:

The Link
The first file is the .mov file of course.

Lordcoffee
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

Try to use $image['mime'] instead of $file['mime'].

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
lordcoffee
Regular
Posts: 308
Joined: Tue Nov 29, 2005 10:22 pm
Location: Munich - Germany
Contact:

Post by lordcoffee »

Garvin you're great! :D

That works! One Problem left and I have my blogintern gallery...
The files wich are no images (like mov or pdf) are added with this little "link" Icon from Carls default Theme because the style.ccs of the theme says, all links have to show this icon. where and what have I to change to get this Icon away but only in the gallery. In the entrys its ok if its there.

Example here
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

Carl's link icon has been removed from his theme in the 1.0 branch and 1.1 trunk since it generally imposes BC problems. So please update your template and remove the CSS instructions also there.

The CSS code did not work in a backwards compatible way, so we first need to have 1.0 working for a bit, where a new CSS selector has been introduced that allows this styling in future releases.

Search for "background-image" declarations in your style.css file and then remove those which are repsonsible for the link icon...

Have fun,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Post Reply