Facebook minimum image size (solution) | Optimizing All in One SEO Pack Pro | Support | Semper Plugins

Avatar
Lost password?
Advanced Search
Forum Scope


Match



Forum Options



Minimum search word length is 3 characters - maximum search word length is 84 characters
sp_Feed Topic RSS sp_TopicIcon
Facebook minimum image size (solution)
August 24, 2014
1:00 am
Avatar
Alex Kramer
New Member
Guests
Forum Posts: 1
Member Since:
August 24, 2014
sp_UserOfflineSmall Offline

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”;
// }
}

August 25, 2014
4:04 pm
Avatar
Peter Baylies
Admin
Forum Posts: 578
Member Since:
October 16, 2011
sp_UserOfflineSmall Offline

** You currently do not have permission to see this post. To obtain access to these Premium Support Forums, please purchase a plugin and support subscription from Semper Plugins **

Forum Timezone: America/New_York
Most Users Ever Online: 964
Currently Online:
16
Guest(s)
Currently Browsing this Page:
1 Guest(s)
Top Posters:
Member Stats:
Guest Posters: 36
Members: 22828
Moderators: 0
Admins: 8
Forum Stats:
Groups: 4
Forums: 28
Topics: 2095
Posts: 9107
Newest Members:
Benjamin Klarer
Administrators: Michael TorbertPeter BayliesSupport TeamSteve MortiboyMatthew RobinsonSteve Klasen, Arnaud: 239Ashish Ravi
[i]
[i]
Skip to toolbar