Gif support

Any future plans or some hack I can make myself to support gif uploading?

Before rtMedia, I could upload gifs as usual media and they were displayed with no problem? did something change?

Okaaay, so again, I had to done a little bit more inverstigation before posting :slight_smile:

In rtMedia settings photo file extensions list only “jpeg, png”.

I found this object which is responsible for outputing them right?

        public function correct_upload_filetypes() {  
            global $rtmedia;  
            $upload_filetypes_orig = $upload_filetypes = get_site_option('upload_filetypes', 'jpg jpeg png gif');  
            $upload_filetypes = explode(' ', $upload_filetypes);  
            if (isset($rtmedia->options['images_enabled']) && $rtmedia->options['images_enabled']) {  
                $not_supported_image = array_diff(array('jpg', 'jpeg', 'png', 'gif'), $upload_filetypes);  
                if (!empty($not_supported_image)) {  
                    $update_image_support = NULL;  
                    foreach ($not_supported_image as $ns) {  
                        $update_image_support .= ' ' . $ns;  
                    }  
                    if ($update_image_support) {  
                        $upload_filetypes_orig .= $update_image_support;  
                        update_site_option('upload_filetypes', $upload_filetypes_orig);  
                    }  
                }  
            }  
            if (isset($rtmedia->options['videos_enabled']) && $rtmedia->options['videos_enabled']) {  
                if (!in_array('mp4', $upload_filetypes)) {  
                    $upload_filetypes_orig .= ' mp4';  
                    update_site_option('upload_filetypes', $upload_filetypes_orig);  
                }  
            }  
            if (isset($rtmedia->options['audio_enabled']) && $rtmedia->options['audio_enabled']) {  
                if (!in_array('mp3', $upload_filetypes)) {  
                    $upload_filetypes_orig .= ' mp3';  
                    update_site_option('upload_filetypes', $upload_filetypes_orig);  
                }  
            }  
            echo true;  
            die();  
        }

I searched my database for “upload_filetypes” meta_key but nothing, so it means
$not_supported_image = array_diff(array(‘jpg’, ‘jpeg’, ‘png’, ‘gif’), $upload_filetypes);

those arrys are equal so $not_supported_image should be empty and … ? thats where I lost trace :smiley:

anyways I can’t understand is it my istallment or plugin?

@Radikal Edward you can use rtmedia_plupload_files_filter filter to add other file format support.

Thanks, but my problem is I can’t upload a music file over 20MB. Even tho it say I can upload 200mb on the free plan

can you show me an example pf filter I need to add in my functions.php?

apply_filters(‘rtmedia_plupload_files_filter’, array(array(‘title’ => “Media Files”, ‘extensions’ => “jpg, gif”)))

will this work?
and last: I don’t have gif support because I don’t have “upload_filetypes” option in my database, is it right?
and is it okay?

Hey,

I would also like to have the gif support and I’m a bit surprised by the answer here…
I’ve tested the filter and it already returns gif extension :-/

add_filter ('rtmedia_plupload_files_filter', 'add_gif_support_rtmedia');  
function add_gif_support_rtmedia($allowed_types) {  
	var_dump($allowed_types);  
	return $allowed_types;  
}

The var dump returns:
array(1) { [0]=> array(2) { [“title”]=> string(11) “Media Files” [“extensions”]=> string(24) “mp4,jpg,png,jpeg,gif,mp3” } }

As you can see gif is already part of it and still can’t get any to display…

Any other idea how to solve this one?

Thanks a lot for your help!
–Olivier

sorry wrong issue!
The gif gets properly loaded in the media library of the user but seems to get filtered from the activity…
Use case:

  1. Post a jpg / png from activity -> works
  2. Post a gif from activity -> no image in activity but image uploaded to the gallery
  3. Upload a gif / png / jpg from the user gallery -> works and display the activity containing the image!

Any idea here? I’m really getting lost now!

P.S.: none of those gif use cases works on your demo site btw!

Seems to be working now using this code in functions.php

add_filter (‘rtmedia_plupload_files_filter’, ‘add_gif_support_rtmedia’);
function add_gif_support_rtmedia($allowed_types) {
//var_dump($allowed_types);
$allowed_types[0][“extensions”] .= ‘,gif’;
return $allowed_types;
}

The only remaining issue will be the fact it might use the thumbnail version of it which obviously will not be animated anymore in such case :wink:

Any brilliant idea for this very last bit to perfection? :wink:

any updates?

Hi,
I’ve added the code into the theme functions.php and the gif upload ability only works if I use the upload area on the media tab in the profile.

For some reason I’m not able to upload gifs from the activity feed.

Any help would be greatly appreciated as I need to be able to allow members to upload gifs via the activity feed.

Thank you,
Nicholaus

Hi,
@vintagers - Thanks for the support

@Radikal Edward & @nicholaus1221 - @vintagers code should do the trick for you. Also in activity stream media is only uploaded once post update is clicked on.

@lloyd.deberry - Even though the free plan support uploading of 200MB, your server should also support the same. You may need to tweak your server settings to allow a larger file.

Sadly it don't.

Even without this function $allowed_types returns:

array(1) { [0]=> array(2) { ["title"]=> string(11) "Media Files" ["extensions"]=> string(24) "jpg,jpeg,png,gif,mp4,mp3" } }

for both, administrator and usual user. but only as Administrator I'm able to post gif animations, but usual users only static pictures.

I'm I the only one with such problem?


Okay edit: I confirm what @nicholaus1221 sad, as usual user, I'm able to post gif animations from members media area

Sorry one more edit:

Everything works fine ^__^ The thign is that I was trying to add two different images:

One 900kb and other 2,5Mb. when I have limit 2Mb.

So... I'm sure @nicholaus1221 was trying to add image that exceeded file size limit.

Two thing here:

First, It would be great to display some notice when file exceeds the limit

Second, I can post images bigger then limit from members area. <- and this is a bug.

@mpa4hu - Glad to know everything works fine. Also we still have some work to be done on the error handling notices. Regarding the members area couldn't quite get which upload area are you talking about here.

I mean when you post from personal page.

example: http://demo.rtcamp.com/buddypress-media/members/mpa4hu/

I cannot test it on your demo page, since I don't know what filesize limit you are using, but from what @nicholaus1221 says, and from what I'm experencing, I'm pretty sure this is a common bug.

@mpa4hu - I just tested it and everything seems to work fine as per the upload limit is concerned on both the members and the activity area.