Posting to Bluesky via the API from PHP – Part Ten – Adding ALT tags to Images

I have to admit that I didn’t think I’d be back with another post on my php2Bluesky library quite so soon but Dr Paul Lee on Bluesky pointed out that while you can post images from the library you can’t also send ALT text to go with them.

But what is ALT text?

Alt text is descriptions of images added to the HTML or metadata of a post on social media or websites. They are primarily used for accessibility and SEO purposes. Here’s what they do:

1. Accessibility

  • ALT text helps visually impaired users understand the content of images through
Read the rest

Posting to Bluesky via the API from PHP – Part Nine – Handling Hashtags

Bluesky has gone from a very niche platform to one that is getting more coverage and seeing explosive growth thanks in part to the actions of the overlord at Twitter. The following was the count of users when I wrote this post.

Expanding functionality

At the same time as the user growth, the platform itself has been growing features to bring it more in line with what its competitors are offering. This includes hashtags, which are now fully supported both in the app and API. What this also means is that I can now add support for … Read the rest

A Minor Update to my Bluesky Library

A quick post to say that my Bluesky library has had a small update. This is to take into account that from version two of Clark’s library that handles the calls to Bluesky the connection method has changed. Therefore, if you have updated to version two then remember also to update the PHP2Bluesky code which can be found here.

You can read all the posts on the PHP2Bluesky library here and get in touch if you find any issues or have an enhancement suggestion.… Read the rest

Posting to Bluesky via the API from PHP – Part Eight – Retrieving a Post

Once again I have been looking at the Bluesky API as part of a question posted on my Github respository. This time the question was “Can I specify one URL and use PHP to retrieve only one bluesky post by someone else?”. You don’t actually need my library to do that but I thought it would be useful to post details here as it’s not immediately obvious.

Identifying an Individual Post

The first thing to consider is how to identfy an individual post. Consider that we want to retrieve the following post progamatically.

Looking at the URL for this Read the rest

Posting to Bluesky via the API from PHP – Part Seven – Handling Multiple Images

It really is very gratifying when people use your code in their own projects and get in touch to ask questions, suggest changes or, heaven forbid, highlight bugs! Yesterday, someone raised an issue asking if it was possible to upload four images to a post. Let’s take a look and see…

Who Wants Multiple Images Anyway?

To be honest, when I wrote PHP2Bluesky it was very much for my own project and that only required one image per post. However, Bluesky allows up to four images to be uploaded per post and so I can understand why others would want … Read the rest

Posting to Bluesky via the API from PHP – Part Six – Handling Handles and Oversized Images

I wrote a series of posts towards the end of the year that took you step-by-step through using the Bluesky API to post to the social network. Having used the code Patrick Delahanty got in touch to say that he had found a couple of issues. Firstly, handling user handles and secondly dealing with large images. Let’s take a look at both of those.

Handling User Handles

As with every social network, Bluesky allows you to select (or assigns for you) a unique user handle. As we saw in the last post I have changed mine to be my … Read the rest

Changing your Bluesky handle to be your own domain

I’m liking Bluesky, which is a little like a rough around the edges X without the toxicity found there. And here’s a neat thing you can do on Bluesky that you can’t on X. If you have your own domain you can use that as your Bluesky handle. In the rest of this article, we’re going to look at how you do that.

Why would you want to do it?

First off why would you want to do so and what are the implications of making the change? I see a number of reasons to make the change:

  1. it
Read the rest

Posting to Bluesky via the API from PHP – Part Five – Putting it all Together

In this series of posts we have looked at:

In this final post we are looking at putting it all together. This includes a worked example plus a complete library of functions that will allow you to easily interact with the Bluesky API.

The Prerequisites

What this project has predominately been about is the correct formatting of the parameters that need to be passed to the Bluesky API. This code does not directly call the API but uses BlueskyApi by Clark Rasmussen to do that.

Here’s … Read the rest

Posting to Bluesky via the API from PHP – Part Four – Link Cards

In this we post we are continuing to look at accessing Bluesky from the API via PHP. Previously we looked at making a connection to Bluesky, posting text, images and handling links and in this post we take a look at Link Cards.

What Even IS a Link Card?

Link Cards are the snippets of a website that is linked to a post that you will no doubt be familiar with seeing elsewhere. Typically, elsewhere these are handled for you but not in Bluesky – here you do all the heavy lifting.

Example of a Link Card

Fetching Details

Read the rest

Posting to Bluesky via the API from PHP – Part Three – Links

So far we have looked at making a connection to Bluesky, posting text and images. In this post I want to look at how links are handled. Unlike X and Mastodon on Bluesky when you post text that includes one or more links these are not parsed and activated. You have to tell Bluesky that you have links in your text and where they are.

Parsing for Links

In order for links to be handled correctly by Bluesky in addition to the text itself you also need to pass an array as part of the parameters giving the start … Read the rest