• Resolved swahlgren

    (@swahlgren)


    The sidebar widget currently shows a 150×150 image css-resized to 50×50. The 50×50 size is in the media library so it’d be really nice for pagespeed if the widget just used the 50×50 size instead of resizing.

    The page I need help with: [log in to see the link]

Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter swahlgren

    (@swahlgren)

    I got a guy on fiverr to do it. Msg me if you want the necessary changes.

    Plugin Support raducan

    (@raducan)

    Hi @swahlgren,

    Thank you very much for putting time and effort looking into a solution, we’d be happy to see what you did.
    Could you submit a pull request here: https://github.com/Codeinwp/wp-product-review ?
    Or if there’s an easier way for you to share it please let me know.

    Thread Starter swahlgren

    (@swahlgren)

    Here’s the file I got from the guy who made it. Names of the files 2 and 3 that are mentioned in the comments must be swapped but other than that it’s the solution I’m using right now.

    //////////////////////////////////////////
    //FIRST FILE === wp-content/plugins/vpninfo/rdk_review_image.php
    //////////////////////////////////////////
    
    add_filter( 'wppr_review_image_size','cdctps_review_image_size',20,2 );
    function cdctps_review_image_size($post_id ) {
    	return "full";
    }
    
    add_filter( 'wppr_review_image_size_1','cdctps_review_image_size_1',20,2 );
    function cdctps_review_image_size_1($post_id ) {
    	return "wppr_widget_image";
    }
    
    //////////////////////////////////////////
    //SECOND FILE === wp-content/plugins/wp-product-review/includes/public/layouts/widget/default.php
    //////////////////////////////////////////
    
    //Replace the following content which starts on line 918 to 933
    
    	public function get_small_thumbnail() {
    		// filter for image size;
    		$size        = apply_filters( 'wppr_review_image_size', 'thumbnail', $this->ID, $this );
    		$image_thumb = '';
    		$image_id = $this->get_image_id();
    		if ( ! empty( $image_id ) ) {
    			$image_thumb = wp_get_attachment_image_src( $image_id, $size );
    			if ( $size !== 'thumbnail' ) {
    				if ( $image_thumb[0] === $this->image ) {
    					$image_thumb = wp_get_attachment_image_src( $image_id, 'thumbnail' );
    				}
    			}
    		}
    
    		return apply_filters( 'wppr_thumb', isset( $image_thumb[0] ) ? $image_thumb[0] : $this->image, $this->ID, $this );
    	}
    	
    //With the following content:
    
    	public function get_small_thumbnail() {
    		// filter for image size;
    		$size        = apply_filters( 'wppr_review_image_size', 'thumbnail', $this->ID, $this );
    		$image_thumb = '';
    		$image_id = $this->get_image_id();
    		if ( ! empty( $image_id ) ) {
    			$image_thumb = wp_get_attachment_image_src( $image_id, $size );
    			if ( $size !== 'thumbnail' ) {
    				if ( $image_thumb[0] === $this->image ) {
    					$image_thumb = wp_get_attachment_image_src( $image_id, 'thumbnail' );
    				}
    			}
    		}
    
    		return apply_filters( 'wppr_thumb', isset( $image_thumb[0] ) ? $image_thumb[0] : $this->image, $this->ID, $this );
    	}
    	
    	public function get_small_thumbnail_1() {
    		// filter for image size;
    		$size        = apply_filters( 'wppr_review_image_size_1', 'thumbnail', $this->ID, $this );
    		$image_thumb = '';
    		$image_id = $this->get_image_id();
    		if ( ! empty( $image_id ) ) {
    			$image_thumb = wp_get_attachment_image_src( $image_id, $size );
    			if ( $size !== 'thumbnail' ) {
    				if ( $image_thumb[0] === $this->image ) {
    					$image_thumb = wp_get_attachment_image_src( $image_id, 'thumbnail' );
    				}
    			}
    		}
    
    		return apply_filters( 'wppr_thumb', isset( $image_thumb[0] ) ? $image_thumb[0] : $this->image, $this->ID, $this );
    	}
    
    ///////////////////////////////////////////
    //THIRD FILE === wp-content/plugins/wp-product-review/includes/admin/models/class-wppr-review-model.php
    //////////////////////////////////////////
    
    //Replace the following content on line 18
    
    $product_image         = $review_object->get_small_thumbnail();
    
    //With the following content:
    
    $product_image         = $review_object->get_small_thumbnail_1();
    Thread Starter swahlgren

    (@swahlgren)

    Plugin Support raducan

    (@raducan)

    Thank you kindly for sharing this with me, I’ll send it over to the devs and they’ll look over it.

    Have a great day!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Scaled images’ is closed to new replies.