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"; // } }
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
The topic ‘Facebook minimum image size’ is closed to new replies.