I love these notes on my recent talk!
Tuesday, June 28th, 2022
Sunday, May 15th, 2022
Image previews with the FileReader API
I added a “notes” section to this website eight years ago. I set it up so that notes could be syndicated to Twitter. Ever since then, that’s the only way I post to Twitter.
A few months later I added photos to my notes. Again, this would get syndicated to Twitter.
Something’s bothered me for a long time though. I initially thought that if I posted a photo, then the accompanying text would serve as a decription of the image. It could effectively act as the
alt text for the image, I thought. But in practice it didn’t work out that way. The text was often a commentary on the image, which isn’t the same as a description of the contents.
I needed a way to store
alt text for images. To make it more complicated, it was possible for one note to have multiple images. So even though a note was one line in my database, I somehow needed a separate string of text with the description of each image in a single note.
I eventually settled on using the file system instead of the database. The images themselves are stored in separate folders, so I figured I could have an accompanying
alt.txt file in each folder.
Take this note from yesterday as an example. Different sizes of the image are stored in the folder
/images/uploaded/19077. Here’s a small version of the image and here’s the original. In that same folder is the
This means I’m reading a file every time I need the
alt text instead of reading from a database, which probably isn’t the most performant way of doing it, but it seems to be working okay.
Here’s another example:
In order to add the
alt text to the image, I needed to update my posting interface. By default it’s a little
textarea, followed by a file upload
input, followed by a toggle (a checkbox under the hood) to choose whether or not to syndicate the note to Twitter.
The interface now updates automatically as soon as I use that
input type="file" to choose any images for the note. Using the
FileReader API, I show a preview of the selected images right after the file input.
Here’s the code if you ever need to do something similar. I’ve abstracted it somewhat in that gist—you should be able to drop it into any page that includes
input type="file" accept="image/*" and it will automatically generate the previews.
I was pleasantly surprised at how easy this was. The
FileReader API worked just as expected without any gotchas. I think I always assumed that this would be quite complex to do because once upon a time, it was quite complex (or impossible) to do. But now it’s wonderfully straightforward. Story of the web.
My own version of the script does a little bit more; it also generates another little
textarea right after each image preview, which is where I write the accompanying
I’ve also updated my server-side script that handles the syndication to Twitter. I’m using the
/media/metadata/create method to provide the
alt text. But for some reason it’s not working. I can’t figure out why. I’ll keep working on it.
In the meantime, if you’re looking at an image I’ve posted on Twitter and you’re judging me for its lack of
alt text, my apologies. But each tweet of mine includes a link back to the original note on this site and you will most definitely find the
alt text for the image there.
Sunday, April 3rd, 2022
There’s a difference between creativity and production. I knit things but it’s not a creative process for me, it’s a physical one. I’m not interested in doing ‘something new’ with knitting (I don’t even call myself a ‘knitter’ to be honest. I don’t really think I’ve earned it). I haven’t learned the methods of construction. I’ve never tried to make something new out of the stitches I’ve learned. It’s not why I knit. I knit to relax. There’s joy in following a pattern and knowing that a more accomplished, knowledgeable person has done the hard creative work for me, and if I just do what they say, thing’s will probably work out fine. And I love the things I make. I put care into the production process - I take care to get the stitches neat, if I can. But when people look at the things I make and say “you’re so creative” - it’s just not true. In that context I can only ever say “no, I followed a pattern - it’s a good pattern. Do you want the link?”
Tuesday, December 7th, 2021
Writing has been essential for focus, planning, catharsis, anger management, etc. Get it down, get it out. Writing is hard, but it’s also therapy: give order to a pile of thoughts to understand them better and move on.
I concur! Though it’s worth adding that it feels qualitatively different (and better!) to do this on your own site rather than contributing to someone else’s silo, like Twitter or Facebook.
Tuesday, November 16th, 2021
Well, this is just wonderful! Jim has written copious notes after listening to my favourite episode of season three of the Clearleft podcast, measuring design:
I’m going to have to try really, really hard to not just copy/paste the entire transcript of this podcast. It‘s that good. Don’t miss it.
Tuesday, November 2nd, 2021
I love reading about how—and why—people tinker with their personal sites. This resonates a lot.
This website is essentially a repository of my memories, lessons I’ve learnt, insights I’ve discovered, a changelog of my previous selves. Most people build a map of things they have learnt, I am building a map of how I have come to be, in case I may get lost again. Maybe someone else interested in a similar lonely path will feel less alone with my documented footprints. Maybe that someone else would be me in the future.
Oh, and Winnie, I can testify that having an “on this day” page is well worth it!
Tuesday, June 8th, 2021
Here’s a great write-up (with sketch notes) of last week’s conference portion of UX Fest:
There was a through-line of ethics through the whole conference that I enjoyed. The “design is the underdog” is tired and no longer true. I think that asking ourselves “now that we are here, how do we avoid causing harm?” is a much more mature conversation.
Friday, June 4th, 2021
Wednesday, May 12th, 2021
Saturday, February 13th, 2021
Matt wrote recently about how different writers keep notes:
I’m also reminded of how writers I love and respect maintain their own reservoirs of knowledge, complete with migratory paths down from the mountains.
When it comes to retrieving information from this online memex of mine, I use tags. I’ve got search forms on my site, but usually I’ll go to the address bar in my browser instead and think “now, what would past me have tagged that with…” as I type
adactio.com/tags/... (or, if I want to be more specific,
It’s very satisfying to use my website as a back-up brain like this. I can get stuff out of my head and squirreled away, but still have it available for quick recall when I want it. It’s especially satisfying when I’m talking to someone else and something they say reminds me of something relevant, and I can go “Oh, let me send you this link…” as I retrieve the tagged item in question.
But I don’t think about other people when I’m adding something to my website. My audience is myself.
I know there’s lots of advice out there about considering your audience when you write, but when it comes to my personal site, I’d find that crippling. It would be one more admonishment from the inner critic whispering “no one’s interested in that”, “you have nothing new to add to this topic”, and “you’re not quailified to write about this.” If I’m writing for myself, then it’s easier to have fewer inhibitions. By treating everything as a scrappy note-to-self, I can avoid agonising about quality control …although I still spend far too long trying to come up with titles for posts.
I’ve noticed—and other bloggers have corroborated this—there’s no correlation whatsover between the amount of time you put into something and how much it’s going to resonate with people. You might spend days putting together a thoroughly-researched article only to have it met with tumbleweeds when you finally publish it. Or you might bash something out late at night after a few beers only to find it on the front page of various aggregators the next morning.
If someone else gets some value from a quick blog post that I dash off here, that’s always a pleasant surprise. It’s a bonus. But it’s not my reason for writing. My website is primarily a tool and a library for myself. It just happens to also be public.
I’m pretty sure that nobody but me uses the tags I add to my links and blog posts, and that’s fine with me. It’s very much a folksonomy.
Likewise, there’s a feature I added to my blog posts recently that is probably only of interest to me. Under each blog post, there’s a heading saying “Previously on this day” followed by links to any blog posts published on the same date in previous years. I find it absolutely fascinating to spelunk down those hyperlink potholes, but I’m sure for anyone else it’s about as interesting as a slideshow of holiday photos.
Matt took this further by adding an “on this day” URL to his site. What a great idea! I’ve now done the same here:
That URL is almost certainly only of interest to me. And that’s fine.
Monday, October 19th, 2020
I like this idea for a minimum viable note-taking app:
data:text/html,<body contenteditable style="line-height:1.5;font-size:20px;">
I have added this to bookmarks and now my zero-weight text editor is one keypress away from me. You might also use it as a temporary clipboard to paste text or even pictures.
See also: a minimum viable code editor.
Tuesday, April 28th, 2020
This might be the most insightful thing that Dan has written since his seminal 2013 Medium article:
The problem with Scrappy Doo, isn’t that he’s annoying, which he is, but that the ghosts suddenly became real, which is an afront to science.
I know this hot-take is about 40 years old, but I’ve been bottling it up.
Wednesday, February 26th, 2020
This looks like an interesting hypertexty tool.
Tuesday, January 7th, 2020
This is quite remarkable. On the surface, it’s a short article about the Y2K bug, but the hypertextual footnotes go deeper and deeper into memory, loss, grief …I’m very moved by the rawness and honesty nested within.
Thursday, November 7th, 2019
Sunday, June 30th, 2019
Just look at these fantastic pictures that Trys took (very unobstrusively) at Patterns Day—so rock’n’roll!
Stuart took copious notes during every single talk at Patterns Day—what a star!
Friday, March 15th, 2019
Other people’s weeknotes
Thursday, September 6th, 2018
I really like Alice’s updates.
I think I’ll do weaknotes. Some collections of notes. Sometimes. Not very well written probably. Generally written with the urgency of someone who is waiting for a baby wake up.
Monday, July 2nd, 2018
Okay, I think I’m going to have to get this pack of three notebooks: Mercury, Gemini, and Apollo.