Included post link when sharing as image#1078
Conversation
There was a problem hiding this comment.
Pull request overview
Updates the Bluesky sharing payload so that when a post is shared “as image” and a post link is available, the share includes a link-style embed using the uploaded image as the card thumbnail.
Changes:
- For
post_type === 'image', switches to anapp.bsky.embed.externalembed (withthumb) whenpost_urlis present, otherwise keepsapp.bsky.embed.images. - Removes thumbnail-blob upload/attachment for
post_type === 'link'external embeds.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| if ( $post_type === 'link' && isset( $post['post_url'] ) && ! empty( $post['post_url'] ) ) { | ||
| $record['embed'] = array( | ||
| '$type' => 'app.bsky.embed.external', | ||
| 'external' => array( | ||
| 'uri' => $post['post_url'], | ||
| 'title' => isset( $post['title'] ) ? $post['title'] : '', | ||
| 'description' => isset( $post['content'] ) ? $post['content'] : '', | ||
| ), | ||
| ); | ||
|
|
||
| if ( | ||
| isset( $post['post_image'], $post['mimetype'] ) && | ||
| ! empty( $post['post_image'] ) && | ||
| ! empty( $post['mimetype'] ) | ||
| ) { | ||
| $image_blob = $this->upload_blob( $access_token, $post['post_image'], $post['mimetype']['type'] ); | ||
|
|
||
| if ( false !== $image_blob ) { | ||
| $record['embed']['external']['thumb'] = $image_blob; | ||
| } | ||
| } | ||
| } |
There was a problem hiding this comment.
The link-post embed no longer attaches an uploaded thumbnail when post_image/mimetype are present. Previously this code uploaded the image blob and set embed.external.thumb; after this change, link posts will always send an app.bsky.embed.external without thumb. If that thumbnail support is still desired, restore it (or fetch/upload a thumb via a shared helper) so link shares keep their preview image.
|
🎉 This PR is included in version 9.3.6 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
Summary
Include the post link when
Include LinkandShare As Image Postoptions are enabled while sharing the post on Bluesky.Check before Pull Request is ready:
Closes https://github.com/Codeinwp/tweet-old-post-pro/issues/633