WordPress.org

Ready to get started?Download WordPress

Forums

Change Uploaded File Permissions
Uploads directory and Eazyest Gallery plugin (1 post)

  1. klihelp
    Member
    Posted 11 months ago #

    This plugin works well on Namesco hosting.

    One little enhancement could be to get the uploads folder from WordPress and don't require the user to set manually the upload folder.
    Because uploads folder could be defined in wp-config as well.

    Eazyest Gallery plugin upload files into different directory using basic hooks.
    http://wordpress.org/plugins/eazyest-gallery/

    /** Modify thumbHook() to work with Eazyest Gallery
    * - add ID
    * - add Eazyest Gallery check
    */
    function thumbHook($metadata, $id) {
    	if (!UFPWP26)
    		return $metadata;		
    
    	$folder = explode("/",$metadata['file']);
    
        if(count($metadata ['sizes'])) {
    
    		$this->logAction( $id , __('Image ID ','change-uploaded-file-permissions'));
    
        	if ( defined(EZG_SECURE_VERSION) && ezg_is_gallery_image( $id ) ) {
        		// Eeazyest Gallery has different 
    
    				$this->logAction( 'Gallery image', __('Eazyest Image','change-uploaded-file-permissions'));
    
    	            foreach($metadata ['sizes'] as $image_name => $arr_image_data) {
    
    	            	$attached = get_post_meta( $id, '_wp_attached_file', true );
    					$pathinfo = pathinfo( $attached );
    					$dir    = $pathinfo['dirname'];
    
    	                $this->changePermission(  eazyest_gallery()->root() . $dir . '/'. $metadata ['sizes'] [$image_name] ['file'] , false, '' );
    	            }
    
            } else {
            	// Default
    
                foreach($metadata ['sizes'] as $image_name => $arr_image_data) {
    
                    $this->changePermission($metadata ['sizes'] [$image_name] ['file'],true,$folder);
                }
    		}
        }
    
        return $metadata;
    }

Reply

You must log in to post.

About this Plugin

About this Topic

Tags