Title: Facebook minimum image size
Last modified: August 22, 2016

---

# Facebook minimum image size

 *  [Oleksandr](https://wordpress.org/support/users/track77/)
 * (@track77)
 * [11 years, 8 months ago](https://wordpress.org/support/topic/facebook-minimum-image-size/)
 * 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/](https://wordpress.org/plugins/all-in-one-seo-pack/)

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Plugin Support [Steve M](https://wordpress.org/support/users/wpsmort/)
 * (@wpsmort)
 * [11 years, 8 months ago](https://wordpress.org/support/topic/facebook-minimum-image-size/#post-5220329)
 * 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](https://wordpress.org/support/users/track77/)
 * (@track77)
 * [11 years, 8 months ago](https://wordpress.org/support/topic/facebook-minimum-image-size/#post-5220358)
 * 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.

 * ![](https://ps.w.org/all-in-one-seo-pack/assets/icon.svg?rev=2443290)
 * [All in One SEO – Powerful SEO Plugin to Boost SEO Rankings & Increase Traffic](https://wordpress.org/plugins/all-in-one-seo-pack/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/all-in-one-seo-pack/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/all-in-one-seo-pack/)
 * [Active Topics](https://wordpress.org/support/plugin/all-in-one-seo-pack/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/all-in-one-seo-pack/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/all-in-one-seo-pack/reviews/)

 * 2 replies
 * 2 participants
 * Last reply from: [Oleksandr](https://wordpress.org/support/users/track77/)
 * Last activity: [11 years, 8 months ago](https://wordpress.org/support/topic/facebook-minimum-image-size/#post-5220358)
 * Status: not resolved