Worked a little on this especially for mobile. Using a css grid on desktop. I want to keep it as simple as possible.Still need a bit of a tidy. While I was searching I found out about Masonry which look like a nice way to go eventually. Introducing CSS Grid Lanes | WebKit is a good read.
Figure out a simple way to update the database without completely rebuilding it.
Just checking the last 100 photos on flickr once a day with a cron job. I just truncated the original script that built the database. I’ve uploaded a photo or two most days recently and it seems to be working. I could probably cut the numbers checked to 50, as I don’t upload many photos.
Decide on any extra fields and recreate the database.
Not done, but I think I want to add in a smaller image size so I can pull the json into WordPress and add tiny thumbs to my on this day page.
Figure out why I can’t get location information from the database with PHP I can with bash.
This sorted itself out once I check there was some location data for the image in the json when it is received.
I’ve continued to talk to claude.ai a bit in the process. But I’ve been careful to ask for it to discuss approaches & not give me code. I’ve tried to describe my ideas and situation and finish with Can you run through some options & idea, without code? or similar. This has been really helpful. I continue to search for answers to problems with DuckDuckGo too as in the pre ai days.
On This Flickr Day There is a bit more work on making this look nice, but it is a start.
I’ve been thinking about this for a while. A way to show Flickr photos taken “on this day”.
I’ve used the Flickr API occasionally over the years, but calling it directly would take too much time. You would need to page through all the photos 500 at a time until you had all the photos.
So I thought I might build a personal database with the information I needed. This could be updated weekly. I then could pull the information from that in one go. Especially if I store the days and months individually for each photo.
This is somewhat outside my skill set. I’ve used the Flickr Api but do not really know much about databases. In the dim past I think I’ve created them once or twice and used from PHP but with lots of searching.
I planned:
Create a local sqlite database on my mac
Move it to a server
access it from a web page with JavaScript via a PHP file to read the database.
I’ve got some way toward that. I did need a bit of help from claude.ai to get the bash sorted. I’ve just used simple PHP on the webpage so far and managed that with the odd search when I’ve hit an error.
I’ve been thinking a bit about using AI for this sort of thing. My current approach is to use it for specific questions. For example, asking is this a sensible approach, or asking for hep with a line. Rather than write me a whole script to do x, y or z. So I start a script then ask for help when stuck. In the same way I’d have to look up docs or search for the answer to a problem.
Hopefully my next step will be to, after a short interval, go through any files and comment as to what is going on to reinforce my learning.
As I am a complete amateur and do not have anyone to chat about this with, I find using AI quite good fun if I make sure to tell it not to give me whole solutions.
The other thing I’ve been trying with AI is to run any files through asking for them to give any security recommendations.
Next Steps
Create a way to produce JSON rather than a web page with PHP. I could then bring the thumbnails into this site using JavaScript.
Add some sort of lightbox to see the images larger, change the layout & appearance.
Figure out a simple way to update the database without completely rebuilding it.
Decide on any extra fields and recreate the database.
Figure out why I can’t get location information from the database with PHP I can with bash.
I tried Telex out a couple of times. The other day I had an interesting idea.
In talking to teachers about Glow Blogs, one of the recurring themes is that Blogs are not as easy to use as Twitter1. Although the use of X seems to be decreasing in schools, it is a valid point. I’ve pointed out ways of making blogging easier on mobile, but never as simple as tweeting. I certainly prefer blogging on the desktop myself.
When I recently saw Pootle Writer and WordLand I thought that might be an interesting way to go, a simpler editor that uses the Rest API to post to WordPress. I also use micro.blog which has a great mobile ui for posting from your phone in its app. This is very much blue-sky thinking, I don’t expect it would be available for Glow Blogs.
As none these products fitted exactly with my way of blogging2. I explored making my own external editor using a few AI tools. I got a couple working but never completely to my liking. Overall I ended up using WordLand more than any of the others, but mostly on the desktop.
I’d left this idea on the “I might come back to this”” shelf for a while and didn’t think of it when I saw Telex.
Then this week I thought could the simplified posting environment be a block? This would remove authentication and posting directly rather than via the Rest API.
I can’t exactly remember my original prompt and Telex seems to re-write it after submission. Basically I asked for a block that would, for logged on users, provide a simplified posting environment on the front end. Fields for title, body and up to 4 images. The images would be in a gallery. Selectors and inputs for tags and categories. Images would be resized to 1200 pixels max. Markdown could be used.
I think I had a conversation that went on over the next couple of days3.
The first iteration worked but produced a classic editor block. I then asked for various changes, block posts, and tweaked the image gallery for quite a few rounds. Eventually I supplied an example of the HTML I needed, copied from a post with a galley the way I like them.
I asked for the images to be resized in the browser rather than on the back end.
Then I installed the plugin on a test server and tried it on a phone. This led to tweaking the interface a bit more. I also made a custom page template to maximise the screen use for the block.
I then ran the Plugin Check plugin which found a few errors. This led to a lot of repetition, as one error was solved another popped up. These were mostly to do with sanitization.
Eventually I was smart enough to ask: can you check the code for errors here?
Which gave me: I’ll analyze the code for potential errors and WordPress coding standards compliance.
I had to ask for results: How did that go?
Telex found some issues and listed them. I then asked: As I do not understand the code what would you recommend?
I understand you’re seeing WordPress coding standards warnings about input sanitization, and you’re not sure what to do since you don’t understand the code. Let me give you a straightforward recommendation: My Recommendation: These warnings are safe to ignore in this case. Here’s why:
This was followed by a detailed list of reasons. including:
We’ve already added proper sanitization – The code uses WordPress’s recommended functions (wp_unslash(), sanitize_text_field(), absint()) to clean the data before using it.
The warning is a false positive – WordPress’s code checker is being overly strict about nested arrays. It sees $_POST['images_data']and flags it, even though we’re sanitizing it properly with a dedicated function.
The code is secure – We’ve implemented multiple security layers:
Nonce verification (prevents fake requests)
Capability checks (only authorized users)
Input sanitization (cleans the data)_
Validation (checks data is correct) What this means for you: The plugin is safe to use as-is. The warning is just the checker being cautious about a complex data structure (an array within an array). The actual security measures are properly in place. If you want to submit this plugin to the WordPress.org repository, they may ask about this warning, but you can explain that the data is sanitized through a dedicated function that handles the nested structure properly. Bottom line: You can confidently use this plugin. The warning is more about coding style than an actual security problem.
Which seems good enough for me. It also chimed with the reports from the plugin checker.
I then added (or Telex added for me) a couple more UI tweaks: loading spinners for the images which took a moment to resize and a posting overlay to show that the post was being created.
Thoughts
Although I broadly agree that it should be both more fun and better learning to do it yourself, this is a project that I would really struggle to do myself. I’ve occasionally made very simple plugins, mostly shortcodes. One more complex one took me an age and had a steep learning curve. It is now broken. It was also for the old version of WordPress, blocks seem like another, more complex, world. Telex made a simpler block version for me quite quickly.
Working with Telex reminded me of my time working with developers and testers on Glow Blogs in my early days. Going back and forwards with requirements, tests and refinements. It was quite enjoyable.
I’ve now got a few ideas for improving this or making other similar blocks. For example, I make posts for books I’ve read. They are short and have a very predictable structure. A simplified posting environment for my phone could be useful.
I also think that including analyze the code for potential errors and WordPress coding standards compliance to prompts might save a bit of time.
A few (eek, 10) years ago I tried to make a plug-in for WordPress that would take a gif url and an audio url, it would then, on the fly, make a static version of the gif. Clicking that would play the gif and loop the audio. I did get it working, eventually adding a dialogue to search for gifs on giphy & audio on freesound. I even managed to incorporate it into the tinyMCE editor in WordPress. It never got finished, but it was fun. I didn’t see any make a site for it: GifMovie.
Making that plug-in involved a big effort on my part, and a ton of searching. I’ve occasionally thought it might make a WordPress block, but didn’t know where to start. I have baby steps, php, JavaScript and css. I’ve occasionally manages to add something to WordPress that I’ve needed mostly through creating shortcode. Simple stuff far short of creating a block.
Test Telex, I thought something similar might be an idea. I simplified a bit leaving out the freesound and giphy searches.
On opening Telex you are shown a typical ai prompt box. But behind that is a WordPress site. I am presuming this is WordPress playground, everything in the browser? I am not familiar enough with playground to be sure. I put in the prompt:
I’d like a block that would allow me to add a gif from the media library. It would allow me to choose a sound from the media library. When the block loads it would show a static image from the gif, generated on the fly with JavaScript with a play button. Clicking the static image would show the gif and loop the audio file.
And off the ai went, showing me some codes scrolling past and telling me how many lines of code it had written. After a while I had the block in the editor in front of me!
I could upload a gif and a mp3 to the block and it showed a preview. All looking good, I could preview the block right in the page. When I went to look at the published page, it looked ok, clicking the image started the sound, but the image vanished.
So I reported this and the ai offered a fix. At that point things went a bit wrong. The page stopped loading and restarting the whole thing failed to load the editor. After a few tries I gave up as I’d run out of time.
This evening I thought I’d try again, but a on a desktop rather than my now aging, 8th gen iPad. As this is all linked to my WordPress account I just opened the project. Getting the same problem I reported it to the ai and it fixed it again. To no avail. I repeated this a couple of times and tested each iteration. After a few goes everything just worked.
I downloaded the plug-in, uploaded it to a test site and it worked fine there too.
I also ran the plugin check plugin and almost no few errors. Presumably because this sort of plugin has fewer opportunities to make mistakes.
I guess this is as near to pure vibe coding as you get? I didn’t see any code at all in the process or discuss it with the ai. I just reported the problem. There is a code view where you can see all of the files created. They look as if they are very well organised and commented. I am sure if I was learning to make blocks this would help a lot.
The few times I’ve asked Claude.ai or chatGPT to do some coding I’ve had more of a view and understanding of what is going on. I’ve also noticed that if chatGPT tried to fix something it either manages straightaway or just repeatedly fails. Telex made a better job of fixing things on at least this one off.
I wonder if this will eventually make its way in to WordPress itself? What sort of overhead would having a bunch of extra block plugins added?
I guess that this could be a good learning tool, but that might require a bit more discipline in reading the code produced and other tutorials on creating blocks. I do feel I’ve learnt something when I’ve DIYed some simple stuff. Not that I’ve retained a lot, that would need more frequent application on my behalf.
I am looking forward to watching the progress with Telex and see where it goes if it gets out of the experimental phase.
A couple of days ago I saw a “guess the cubomania” challenge from Theo. I’ve had an interest in Cubomania in the past and played around with the idea a bit. After a chat with D. who gave me a few engravers I googled a bit and guessed, wrongly, Goya.
Next I thought to ask ChatGPT. It suggested it could match by image matching techniques, gave me a fairly obviously wrong first row and ran out of credit.
I then thought to ask Claude to make me an interactive page where I could drag things around. It made a couple of not very good attempts.
I was thinking about a better prompt, when I remembered and asked:
Could we use the whole image for each piece but ‘crop’ it with css?
Claude replied:
Brilliant idea! Yes, we can absolutely use CSS to create a “window” effect where each piece shows only its portion of the full image. This is much more elegant than trying to extract individual pieces.
I was flattered1 and when Claude came up with another fail I decided to abandon AI and DIY. This turned out a lot better. I started by remembering background-position and finding interact.js . The last time I did any drag and drop I dimly recall some sort of jQuery and a shim for mobile/tablets. interact.js did a grand job for my simple needs. It was probably overkill as it seems to do a lot more.
It is pretty simple stuff, but potentially a lot of fun, different images, making cubomania puzzles who knows. I did extend it a bit, learning about localStorage (to save any progress) and the dialogue tag. All without AI but few visits to HTML reference – HTML | MDN and the odd search.
I had a lot of fun with this, more than if I had just managed to get either of the AIs it to do the whole thing. What it did make me think of is that AI chat was useful for working out what I wanted to do and how to do it. I could probably have done that bit too all by myself. Usually I just start messing about and see what happens. This points to a bit of planning, or maybe typing some notes/pseudocode/outline might work for me when I am playing.
The Featured Image of this post was generated by ChatGPT in response to ” I want an image of a chatbot character chatting with a person, friendly, helpful & futuristic.” It has been run through Cubomania Gif!
I’ve been playing a little with WordPress yesterday. A while back I made the very simplest plugin to display my latest iNaturalist submissions. iNaturalist has a API so I made a short code that would then use JavaScript to pull in the pictures once the page loaded.
The only problem with that is that when the page loaded it just displayed a div with ‘loading’ then replaced that with the images when a script pulled that in. This appeared in the RSS feed too.
I thought that it might be better to do this server side so the images would show in an RSS feed.
This worked out ok once I had remembered lines need to end in semi-colons in php. It was still very basic so I ran it past Claude.ai and asked for security and caching advice. It made a couple of suggestions which I read up a little about and implemented.
I’ve tried using AI for a few code ideas and I am beginning to see what does and doesn’t work. What doesn’t work for me is to ask it to build a whole idea. This has nearly always ended up in problems which seem to loop around. What does work is to ask for somethings specific. In this case I uploaded the plugin to Claude and asked it to find any security problems. It did and suggested some fixes. I am sure that these are simple things that any WordPress developer would carry out without thinking about.
I’ve also found getting basic information around a function works well with AI. For example Claude suggested using the transient to cache the data from the API. Asking ChatGPT to explain transient gave me a quick handle on the function. (I am sure Claude would have explained too).
Anyway I have made some progress.
This was a good day:
The above produced with this shortcode:
[[inaturalist user="troutcolor" on="2024-07-30"]]
I’d now like to add some more ideas: names looking a little prettier than the description tooltip, maybe a lightbox view with more information and a link to iNaturalist. But I am not in any rush.
The bit I enjoyed most, though, was the punchline at the end. “The irony”, wrote Claude, “is that by calling LLMs ‘artificial intelligence’, we’re not just mischaracterising what these systems do; we’re also impoverishing our understanding of what human intelligence actually is.
Refreshing, straightforward piece from yesterday’s Observer.
I thought it might be worth noting this use of claide.ai. I’ve seen a wide variety of views on AI and its promise & pitfalls. When it comes to writing a wee bit of code I feel a lot of sympathy with Alan’s approach. But I have dabbled a bit and do so again this week.
I use gifsicle a bit for creating and editing gifs, it is a really powerful tool. I think I’ve a reasonable but limited understanding of how to use it. In the past I’ve used it for removing every second frame of the gif and adjusting the delay.
This is pretty crude and you need to manually edit the number of frames and guesstimate the new delay which will be applied to every frame1.
I know gifsicle can list the delays of each frame with the –info switch, but I do not know enough enough bash to use that information to create a new gif. I had a good idea of the pseudo code needed but I reckoned that the time it would take to read the man page and google my way to the bash syntax needed was too much for me.
This week I was trying to reduce a gif I’d made from a screen recording. It turned out a bit bigger than I had hoped. I tried a couple of application but didn’t make much of a dent. I decided to ask Claude:
I am using gifsicle/ I want to input a gif, and create a new one. Explode the gif, delete ever second frame and put an animated gif back together doubling the delay for each frame. So a gif with 20 frames will end up with 10 frames but take the same length of time. I’d like to deal with gifs that have different delays on different frames. So for example frame 1 and 2 the delays for these frames added together and applied to frame one of the new gif.
The original query had a few typos and spelling mistakes but Claude didn’t mind. After one wrong move, when Claude expected the gifsicle file name to be slightly different I got a working script and took my 957KB gif down to 352KB, that was the image at the top of the pos2t.
I had asked for the script to use gifsicle explode facility to export all of the frames. Which the script did, neatly in a temporary folder. As I typed up this post, looking at my original attempt, I realised I should not have asked for the script to explode the gif, but just grab every second frame from the original. This seemed more logical and perhaps economical, so I asked Claude to take that approach. The final script has been quickly tested and uploaded a gist: gif frame reduction in case anyone would find this useful.
Of course this has added to the pile of not quite formed reflections on AI and should we have anything to do with it. I don’t feel too guilty as I needed at least a little gifsicle knowhow to get started.
Original Gif 311KBReduced, every second frame gif 225KB
The seq command just outputs a sequence of numbers from 0 to 20, counting up in steps of 2. The -f “#%g” makes it print a # before each number, which makes gifsicle understand it as a frame selection instead of a file name. The backticks around the seq command cause its output to be included as parameters in the gifsicle command line. I am sure I googled to work that out↩︎
There is a difference between the sizes reported by the Finder & WordPress. The wordPress ones are on the image caption. ↩︎