Adding labels to media with php2Bluesky

Someone mentioned to me that you can add labels to posts in Bluesky and I have to admit that I had not idea what they were referring to. Looking at them I can understand why I’d not come across them – I’d not had any need for them but what are labels?

Bluesky Labels

A Bluesky label is a tag you can add to your own post to warn others (and moderation tools) that your content may include things like nudity, violence, sexual content, or graphic imagery. They:

  • Enable users to filter or blur posts based on content type.
  • Help
Read the rest

Uploading Videos with php2Bluesky

Ever since I launched php2Bluesky a couple of years ago, I have wanted to add the ability to upload video as well as images. Initially, that wasn’t possible as Bluesky didn’t support videos, and then they did, but it wasn’t in the API. Now, however, it is all systems go, and so I have updated the library to support videos.

How to Upload a Video

First things first. In order to start uploading videos all you need to do is update the library. The way you call the library remains exactly the same, so you would do the following to … Read the rest

Using php2Bluesky without Composer post v2.0.14

In January I wrote about Using php2Bluesky without Composer for those that wanted to take this approach. Since then I have updated the code so that it conforms to PSR-4 for loading with Composer. This in turn has a knock-on effect for those loading manually. The rest of this article explains how loading now needs to take place.

Multiple Files

Prior to v2.0.14 all the code was contained within a single file called functions.php. The naming reflected the history of the library which was originally developed to be included as part of a larger project. When I spun it out … Read the rest

Using php2Bluesky without Composer

I have been asked how to use my php2Bluesky library without having to install it using Composer. Given that this is a common request I thought that I would document it here.

Pros and Cons of Composer

Before we get into the specifics of using php2Bluesky without Composer let’s take a quick look at the pros and cons of using Composer. Feel free to skip this bit and go straight to how to use php2Bluesky without Composer!

Using Composer to install a package has several advantages over manually downloading the code and requiring it. Composer automates dependency management, … Read the rest

Introducing v2 of php2Bluesky

There was an issue raised recently on my php2Bluesky library pointing out that the dimensions of images weren’t being passed and so they weren’t being displayed on Bluesky correctly. On investigation, I found this to be correct, but because of the way the code was currently implemented, I couldn’t fix it. The library needed to have control of the upload of images in order to get the dimensions and currently that wasn’t the case.

Breaking Changes Incoming

The history of php2Bluesky is that it started as a series of functions in a larger side project I was working on. I … Read the rest

Handling unicode and missing link card images in php2Bluesky

I have just committed a couple of changes to my php2Bluesky library. This release includes a simple change to enable the support of international characters in hashtags and a more complex (to explain) change to the options for link cards.

International support

This was a change to the regex used in the library to identify the start and end points of hashtags. The previous code used /#(w+)/ which matches only Alphanumeric characters: [A-Za-z0-9] and an underscore _. This meant that hastags such as #Gütersloh failed to be recognised correctly. Now the regex is /#([\p{L}\p{N}]{1,})/ this now supports:

  • Latin
Read the rest

An update to php2Bluesky

I’ve just committed a couple of changes to my php2Bluesky library based on suggestions and/or code provided by others. These are:

  1. new function, permalink_from_response, which will return a permalink given the response from post_to_bluesky (@BobaFettFanClub)
  2. you can now provide your own image for a link card just include the link in post_to_bluesky (@bearlydoug)
  3. start of some error checking

Clearing Some Confusion

I have also received some feedback that the blog posts written when I was first investigating posting to Bluesky are confusing if you are only looking to be able to use the library itself. Looking … Read the rest

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

NOTE: This post is mainly about how I developed the php2Bluesky library. If you are looking for information on using the library in your own code please see here: https://github.com/williamsdb/php2Bluesky/

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 … 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