WordPress.org

Ready to get started?Download WordPress

Forums

rtMedia for WordPress, BuddyPress and bbPress
[resolved] I Fixed a BUG. Please Hardcode to future release (2 posts)

  1. glyndavidson
    Member
    Posted 7 months ago #

    To the developers of this plugin...

    First of all, thanks very much, this is an excellent tool that has saved me a huge amount of effort.

    Upon first installation, I found it to be quite buggy so am holding off from purchasing the pro version and tagging addon just yet.

    In the meantime, could you add one of my fixes to the original code please so that I don't have to keep changing it everytime I do an update?

    Here's how to reproduce the error:

    1. On a Linux server, go to: http://%user_domain%/members/$user_name%/media/
    2. Click on 'Upload' > 'Select Your Files'
    3. Select an image, or a group of images, with the file extension .JPG (Note, the extension is in capitals).

    Nothing appears to happen, but actually, rtMedia is secretly uploading the files in the background. Unaware of this, you try uploading them again, and again, and ARGH!!! Stupid plugin! Oh, hang on a minute...

    All of my images have been uploaded 5 times!

    To fix this bug I modified these functions:

    /app/admin/rtMediaAdmin.php

    public function correct_upload_filetypes () {
                global $rtmedia;
                $upload_filetypes_orig = $upload_filetypes = rtmedia_get_site_option ( 'upload_filetypes', 'jpg jpeg png gif' );
                $upload_filetypes = explode ( ' ', $upload_filetypes );
                if ( isset ( $rtmedia->options[ 'images_enabled' ] ) && $rtmedia->options[ 'images_enabled' ] ) {
    		// Glyn Hack (Add file extensions in capitals, otherwise it crashes when trying to upload img: JPG JPEG PNG GIF
                    $not_supported_image = array_diff ( array( 'jpg', 'jpeg', 'png', 'gif', '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;
                            rtmedia_update_site_option ( 'upload_filetypes', $upload_filetypes_orig );
                        }
                    }
                }

    AND

    public function upload_filetypes_error () {
                global $rtmedia;
                $upload_filetypes = rtmedia_get_site_option ( 'upload_filetypes', 'jpg jpeg png gif' );
                $upload_filetypes = explode ( ' ', $upload_filetypes );
                $flag = false;
                if ( isset ( $rtmedia->options[ 'images_enabled' ] ) && $rtmedia->options[ 'images_enabled' ] ) {
                    $not_supported_image = array_diff ( array( 'jpg', 'jpeg', 'png', 'gif', 'JPG', 'JPEG', 'PNG', 'GIF' ), $upload_filetypes ); // <-- Glyn Hack
                    if ( ! empty ( $not_supported_image ) ) {
                        echo '<div class="error upload-filetype-network-settings-error">
                            <p>
                            ' . sprintf ( __( 'You have images enabled on rtMedia but your network allowed filetypes does not allow uploading of %s. Click <a href="%s">here</a> to change your settings manually.', 'rtmedia' ), implode ( ', ', $not_supported_image ), network_admin_url ( 'settings.php#upload_filetypes' ) ) . '
                                <br /><strong>' . __( 'Recommended', 'rtmedia' ) . ':</strong> <input type="button" class="button update-network-settings-upload-filetypes" class="button" value="' . __( 'Update Network Settings Automatically', 'rtmedia' ) . '"> <img style="display:none;" src="' . admin_url ( 'images/wpspin_light.gif' ) . '" />
                            </p>
                            </div>';
                        $flag = true;
                    }
                }

    in app/main/rtMedia.php

    function set_allowed_types() {
            $allowed_types = array(
                'photo' => array(
                    'name' => 'photo',
                    'plural' => 'photos',
                    'label' => __('Photo', 'rtmedia'),
                    'plural_label' => __('Photos', 'rtmedia'),
                    'extn' => array('jpg', 'jpeg', 'png', 'gif', 'JPG', 'JPEG', 'PNG', 'GIF'),  // <-- Glyn Hack
                    'thumbnail' => RTMEDIA_URL . 'app/assets/img/image_thumb.png',
    		'settings_visibility' => true
                ),

    Could you please add these changes to future releases so that I don't have to keep changing them? I haven't tested it but I'm guessing it does the same thing with MPG etc as well.

    http://wordpress.org/plugins/buddypress-media/

  2. rtCamp
    Member
    Plugin Author

    Posted 6 months ago #

    This has been fixed with latest rtMedia release. Please refer this topic https://rtcamp.com/support/topic/bug/

Reply

You must log in to post.

About this Plugin

About this Topic

Tags