• The image smaller when 200px cannot will be used in the facebook.
    But this code can solve this issue.
    Please add this ability as default into your code.
    I hope you can understand what is means (it work for me)
    Thanks.
    file: aioseop_module_class.php
    function: get_the_image_by_post_thumbnail

    $size = apply_filters( 'post_thumbnail_size', 'large' );
    			$image = wp_get_attachment_image_src( $post_thumbnail_id, $size );
    			$filepath = $image[0];
    			// check if image sizze is supported with facebook
    			$minimum_size = 200;
    			if($image[1] < $minimum_size||$image[2] < $minimum_size ) {
    				$full_url = url_to_absolute( get_site_url(), $filepath );
    				$old_path = $this->get_local( $full_url );
    
    				$image_edit = wp_get_image_editor($old_path);
    				if ( ! is_wp_error( $image_edit ) ) {
    					$path_parts = pathinfo($old_path);
    					$new_file_name = $path_parts['filename']."-$minimum_size".'x'."$minimum_size.".$path_parts['extension'];
    					$new_file = $path_parts['dirname']. DIRECTORY_SEPARATOR . $new_file_name;
    					if(!file_exists($new_file)) {
    						$image_edit->resize( $minimum_size, $minimum_size, true );
    						$image_edit->save( $new_file );
    						$filepath = dirname( $full_url ) . DIRECTORY_SEPARATOR . $new_file_name;
    					}
    				}
    				// else {
    					// echo $image_edit->get_error_message();
    					// echo "<br>$filepath";
    				// }
    			}

    https://wordpress.org/plugins/all-in-one-seo-pack/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Support Steve M

    (@wpsmort)

    Thank you for the suggestion and the code. I think the right thing for us to do here going forward is to add a warning to users if they have an image set that is too small, I will put that on the plugin development roadmap and see if it is feasible for the next major release. The problem with upsampling an image smaller than 200px is that it’s likely to end up looking terrible, especially on mobile / retina – really, it’d be better to alert the user to give them the opportunity to provide a larger image.

    Thread Starter Oleksandr

    (@track77)

    The irony is that the what fasebook uses the image smaller what 200px.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Facebook minimum image size’ is closed to new replies.