388: Durable Objects

Robert and I jump on to chat about Cloudflare’s product Durable Objects. It’s part of their Workers platform, which we already use at CodePen a good bit, but with Durable Objects…

Global Uniqueness guarantees that there will be a single instance of a Durable Object class with a given ID running at once, across the world. Requests for a Durable Object ID are routed by the Workers runtime to the Cloudflare data center that owns the Durable Object.

In their intro blog post a few years back, they call the “killer app” real-time collaborative document editing, which is obviously of interest to us. So we’ve been tinkering and playing with how that might work with CodePen’s future technology.

Time Jumps

  • 00:25 What Robert’s been up to
  • 01:08 What is a durable object?
  • 02:52 Using Workers with durable objects?
  • 08:13 Sponsor: Equinix Metal
  • 08:51 How does clientside work with Workers?
  • 15:58 What if the durable object dies?
  • 19:47 Cost of durable objects

Sponsor: Equinix Metal’s Startup Partner Program

Equinix Metal’s Startup Partner Program helps early stage companies level up. Their experts work with startups like Koord and INVISV to build their competitive edge with infrastructure. Equinix Metal provides real time guidance and support to help startups grow faster. With up to $100,000 in infrastructure credit, access to Equinix’s global ecosystem of over 10,000 customers and 1,800 networks, they might just be what you need to take your startup global.

Visit metal.equinix.com/startups to take your startup to the next level.

The post 388: Durable Objects appeared first on CodePen Blog.

Trick the JVM for Maximum Performance With Megamorphic Call Sites

The JVM does great stuff to let our Java applications run the fastest way possible. Most of the time, you don't have to care about the internals, but if you really need to get the best performance, you need to take into account how JVM works. It's not the goal of this article to give a detailed introduction to this topic but merely to show how our design can impact performance and how you can work around some issues which arise.

An important aspect of performance optimization is inlining, i.e. the JIT replaces a method call with the code that will be executed by the method. For that to work, the method must be short, and it must be clear what the method is called. This is unfortunately not trivial as basically all methods can be overloaded, so the JVM does some run-time analysis and then makes some predictions. It basically distinguishes between monomorphic call sites, which always call the same method; bimorphic ones, which are optimized for two different targets; and call sites calling with more than two targets, which are called megamorphic, where fewer optimizations are applied. This analysis and the resulting optimization are done for each call site individually.

Can You Beat the AI? How to Quickly Deploy TinyML on MCUs Using TensorFlow Lite Micro

Are you curious about artificial intelligence (AI) and machine learning (ML)? Do you want to know how to use it on the microcontrollers you already work with? In this article, we provide you with an introduction to ML on microcontrollers. This topic is also known as tiny machine learning (TinyML). Get ready for losing against an ESP-EYE at the rock, paper, scissors. You will learn about data collection and processing, how to design and train an AI and how to get it running on the MCU. This example provides you with all you need to do your own TinyML project from start to end.

Why Should I Care About TinyML?

Surely you’ve heard of tech companies such as DeepMind and OpenAI. They dominate the ML domain with experts and GPU power. To give a sense of scale, the best AIs, such as those used by Google Translate, need months of training. They use hundreds of high-performance GPUs in parallel. TinyML turns the tables somewhat by going small. Because of memory limitations, large AI models don’t fit onto microcontrollers. The figure below shows the disparity between the hardware requirements.

O11y Guide: Keeping Your Cloud-Native Observability Options Open

This is the fourth article in the series covering my journey into the world of cloud-native observability. If you missed any of the previous articles, head on back to the introduction for a quick update.

After laying out the groundwork for this series in the initial article, I spent some time in the second article sharing who the observability players are. I also discussed the teams that these players are on in this world of cloud-native o11y. For the third article, I looked at the ongoing discussion around monitoring pillars versus phases.

#47 – Adam Silverstein on the State of Images in WordPress

Transcript

[00:00:00] Nathan Wrigley: Welcome to the Jukebox podcast from WP Tavern. My name is Nathan Wrigley.

Jukebox is a podcast which is dedicated to all things WordPress. The people, the events, the plugins, the blocks, the themes, and in this case, the state of images in WordPress.

If you’d like to subscribe to the podcast, you can do that by searching for WP Tavern in your podcast player of choice, or by going to WPTavern.com forward slash feed forward slash podcast. And you can copy that URL into most podcast players.

If you have a topic that you’d like us to feature on the podcast, I’m keen to hear from you and hopefully get you, or your idea featured on the show. Head over to WPTavern.com forward slash contact forward slash jukebox and use the contact form there.

So on the podcast today, we have Adam Silverstein. Adam is a WordPress core comitter, where he works to fix bugs and improve modern web capabilities. As a developer relations engineer in the content ecosystem team at Google, he works to invigorate the open web by empowering and educating developers.

At the recent WordCamp US he gave a presentation entitled images on the web, past, present and future. In it, he outlined his thoughts on where the web is going in terms of support for different image formats.

Alongside text images are the bedrock of webpages. We browse the internet and expect pages to have images of all forms. Photos, illustrations, charts and images to convey additional meaning to the text.

But how do the images actually get on the page? WordPress makes handling images pretty easy, and Adam explains what happens when you upload an image to the media library and then display it on a page or post in a browser.

We discussed the fact that different image sizes are created automatically by WordPress, which can be used in a variety of contexts across your website. You’ve likely heard of many of them. But perhaps you have not thought about which image format belongs where.

As with code, the technology behind images does not stand still. New image formats are being created all the time, and are being supported at differing rates by the major browser vendors.

In the past, we typically used JPEG. GIF or PNG files to display images on our websites, but there’s good reason to think about adopting other defaults in the near future. We discussed some of these new formats, such as WebP, AVIF and JPEG XL, and find out how they are speeding up website loading times because of their smaller file sizes.

We also get into how you can optimize your images and how plugins and SaaS solutions can reduce the size of your files before or after you upload them to your WordPress install.

Adam has some good advice about a topic which is becoming increasingly important, page load time. And if you’ve never given the serious thought, this is a great podcast episode for you.

Typically when we record the podcast, there’s not a lot of background noise. But that’s not always the case. Over the coming weeks, I’ll be bringing you recordings from a recent trip to WordCamp US 2022, and you might notice that the recordings have a little echo or other strange audio artifacts. Whilst the podcasts are more than listenable, I hope that you understand that the vagaries of the real world were at play.

If you’re interested in finding out more, you can find all the links in the show notes by heading over to WPTavern.com forward slash podcast. Where you’ll find all of the other episodes as well.

And so without further delay, I bring you Adam Silverstein.

I am joined on the podcast today by Adam Silverstein. Did I get that right?

[00:04:38] Adam Silverstein: You did. That’s the way I like to pronounce it.

[00:04:40] Nathan Wrigley: Yeah. Perfect. Adam is here because he did a presentation at Word Camp US this year. What was the presentation about Adam?

[00:04:46] Adam Silverstein: It was images on the web, past, present, and future. So kind of like a history of images and also what’s coming in the future for modern image formats.

[00:04:54] Nathan Wrigley: Okay. We’ll delve into that in a moment, but before we do, would you just give us the two minute potted history of Adam. How it is that you’ve come to speak at a WordCamp.

[00:05:02] Adam Silverstein: Sure. Yeah. I mean, I used to build sites in, uh, Dreamweaver. Then I discovered WordPress as a way to let my clients be able to edit their content. Then one day I decided I should contribute back to WordPress. I became super involved in Core and help rewrite revisions for 3.6. Eventually, I became a core comitter. And, worked at agency, 10up, for quite a while, and then eventually wound up on the CMS team at Google. Working on the web platform, trying to make the web platform better. And I still work on WordPress quite a bit in that role.

[00:05:30] Nathan Wrigley: Google seemed to be doing a lot more with WordPress.

[00:05:33] Adam Silverstein: Absolutely. Since about 2017 when they started showing up at every WordCamp. And also they have that first party plugin Site Kit, which is their own plugin that’s very well supported that connects your WordPress site to Google Services.

[00:05:45] Nathan Wrigley: Yeah, we spoke to Felix a few episodes ago. So, if you’re into Site Kit and things like that, you can search for the Felix Arntz episode. But we’re here to talk about images today. And I’m going to lead off with something which is going to make me sound incredibly ignorant, and apologize for that.

And that is simply this. When I visit a webpage or I’m building a website, images basically just magically appear. They’re on my computer. I see that there’s an image, there’s a file name and a file format, JPEG and so on and so forth. But I honestly have no idea how the browser makes the image appear. I don’t know what the mystery voodoo that’s going on in the background to turn a piece of code, I’m guessing, into something visible on the screen. So ridiculous as it may sound. How do we even get images on the web? How does it work?

[00:06:31] Adam Silverstein: Yeah, so it’s not a stupid question because it’s it’s incredibly complex, actually how browsers deal with images. But at a very basic level, typically there’s a lot of ways images actually appear on webpages, because it could be in your css or you could load it dynamically with JavaScript.

But in a normal HTML context, you have an image tag, and that image tag has a url. When the browser first gets your HTML page, it goes through a parsing phase where it tries to decipher what all the elements that I’m gonna need to construct this visual page. What CSS do I need, what images do I need?

So it goes through the HTML and each time it encounters an image. It makes another request back to your web server, that’s running WordPress. And then that image is brought back to the browser. Now that’s a binary format, that image. So the browser also has to have a capability of decoding that image. That’s where support for different image formats come in, and all the browsers support all the formats that we’re used to.

But then there’s these more modern formats that maybe aren’t supported. That’s kind of the simple version of it, is the browser finds the reference that you have on your HTML. Goes out and retrieves it, just like it does any asset, and then it decompresses it and puts it on your display.

[00:07:37] Nathan Wrigley: If I was to look at the binary code, which made up the image. Which I presume is possible? Is it just a combination of letters, numbers, and characters?

[00:07:46] Adam Silverstein: I mean, it’s binary encoding, so I don’t, I don’t actually know what, it’s eight bit probably, or 16 bit encoding. But you’ll have, typically at the first bites of an image will be like a header block. That defines what the image is, the meta information about the image. And then you’ll have the actual data of the image. And that’s in chunks. And it depends on how, what image compression format you’re using.

But typically images are compressed. So you have some information about that compression in the header, and then you have the chunks that make up the file. But it wouldn’t be something, if you looked at it, it wouldn’t make any sense to a human.

[00:08:17] Nathan Wrigley: Right.

[00:08:18] Adam Silverstein: It would just be like binary data, just a bunch of numbers.

[00:08:20] Nathan Wrigley: It kind of reminds me a little bit of TCPIP packets, you know, it’s surrounded with metadata to give, well, in this case it would be the, the OS stack. But, to give the browser information about what’s coming down the pipe in the next moment.

[00:08:32] Adam Silverstein: Right.

[00:08:33] Nathan Wrigley: So how big it is, what the dimensions are, and so on and so forth. And then each little bit will render I guess a pixel or something like that.

[00:08:40] Adam Silverstein: Exactly. You could think of it that way. But you know, in a lot of these compression engines, it’s actually like an eight by eight block, and then there’s more detail. It’s very complicated really.

And even the thing about, like, I very much simplified the how the webpage is loaded because the browser has to decide which resources to load first and which to prioritize. And also just think about an image tag. Image tags now typically have a source set attribute, which indicates which size image we want, depending on the break point that we’re in.

So the browser has to figure out that information as well. It’s quite complex and people have written whole articles on it. So if you’re interested in it, there’s, like in my talk, I’ve got like a links document and there’s some links that I’ve put out to like how browsers work. It is very interesting to understand and I think it, like, can help inform, just the more you understand that, the more you understand why trying to optimize performance is so complex.

[00:09:32] Nathan Wrigley: It really does amaze me, and these days, images on the connection at least that I have in my home, seem to load more or less instantaneously, but I remember going back in the day when it was dial up, this laborious line by line creation of the image. You could watch the image load and it would just sort of generate going down. Do you remember seeing all of that?

[00:09:51] Adam Silverstein: You could see it loading.

[00:09:52] Nathan Wrigley: You could actually see the image loading.

[00:09:53] Adam Silverstein: And you could simulate that, you know, in Chrome using the throttling, in Chrome dev. But the other thing to remember is that, we’re a little privileged here. We have very high speed connections. We have high powered devices, but if you look at the world as a whole, that’s really not the case. There’s still a lot of people in the world who are using low powered, they’re using a phone, it’s not like a smartphone, like an iPhone. It’s a very low powered device. So even just the decoding of the images can be expensive.

And then the bandwidth thing,. Some people, a lot of places in the world, people are paying for bandwidth. So the more bandwidth you use. So they may have images turned off or they may be in a low data mode. A lot of phones support a low data mode where they’ll try to reduce the amount of data that they’re using.

Yeah, it’s interesting. One of the things we introduced recently into Word Press Core is native lazy loading of images. So this is something we used to do in JavaScript, but now is built into browsers. And what it does is it prevents the images that are off your view port from loading until you start scrolling down. Before you reach them, when you start scrolling, as you get closer to the where they’re gonna appear, then it will load those images. So, of course this is great for saving resource because when your page loads, if it’s a long page with many images, you don’t have to load all those images unless and until the user starts scrolling down the page.

And this sounds great, and especially at, in a high speed connection environment, it works great. But someone gave the feedback during the process of introducing this, that they work on a low bandwidth connection. And what they like to do is start loading the page and then they switch to another tab and they wait till everything loads and then they come back and they read all their content. But with lazy loading, it doesn’t work very well because suddenly they scroll a little bit and now they have to wait for another image to load.

[00:11:26] Nathan Wrigley: I’m imagining that typical user is not browsing the web in that way. But that is an interesting.

[00:11:31] Adam Silverstein: Isn’t it?

[00:11:31] Nathan Wrigley: Is an interesting case.

[00:11:32] Adam Silverstein: What it just brings up is that you really have to think about your users. When you’re trying to optimize your site, it’s not just optimizing for yourself, it’s optimizing for your users. And that’s why having real user metrics is so valuable. Collecting actual field data about how people are experiencing your website, as opposed to doing lab tests like we are running lighthouse or page speed insights to try to figure out like, oh, how’s my site performing? That gives you one metric, but that doesn’t tell you how people actually in the wild experience your website. If most people have low bandwidth connections, that’s gonna be really different than what you might get from a local test.

[00:12:03] Nathan Wrigley: Let’s just pivot a little bit and talk about the different types of images there are. I would imagine almost everybody is familiar with the regular, the usual suspects, shall we say.

[00:12:12] Adam Silverstein: Sure.

[00:12:12] Nathan Wrigley: You know, the JPEGs and the PNGs, and don’t even know if that’s how you pronounce it. Some people I’ve heard say, ping. But I always say PNG and I say GIF.

[00:12:20] Adam Silverstein: Yes, and I say GIF.

[00:12:21] Nathan Wrigley: Okay, yeah, but there’s all of these. There’s more, which we’ll get onto later. But presumably there’s dozens more that are not typically used on the web. Why have these formats evolved over time? Why don’t we just have one?

[00:12:33] Adam Silverstein: Right, that’s a great question, I mean, uh, the GIF format came out 35 years ago, and it pretty much did everything we needed to do, right? It could display images, it had animation, it had transparency. Wow, like images on the web. That was actually a big deal at the time. But there were some limitations. It only had 256 colors. So if you wanted to make a photograph, you had to dither the colors and it only had lossless compression, which is not really that efficient. You know, you maybe get 10 or 15%.

And it also had copyright issues. The LZW compression algorithm that was in GIF, there were copyright holders. Big corporations and the free software movement didn’t feel that they could trust this format. That’s part of why PNG came about 15 years ago, was as a response to the limitations of the compression algorithm, the copyrights. Of course PNG also added alpha transparency, which is an improved version of transparency because you can define opacity on a per pixel basis, and this lets you create an image with a transparent background that’s got like smooth edges. Like GIF images with transparent have those like blocky edges. But with a PNG, you can create a gradual fading to opacity.

And that was a big improvement. So it actually added a really useful feature. It’s great for product images, PNGs. Of course, JPEG introduced lossy compression, which let you just tune your compression to whatever level you wanted. You could get 10 times smaller images that still look good, which was really important at that time. But you could also fine tune that if you were a photographer and you wanted higher quality, you could choose that higher quality setting. That was really unique. GIF didn’t have that, right.

And SVG of course is the fourth kind of major one that we use on the web. And that’s just like very different. It’s for illustrations. It’s vector based instead of raster.

[00:14:10] Nathan Wrigley: It’s a file format isn’t it?

[00:14:12] Adam Silverstein: It is, it’s actually XML, think.

[00:14:13] Nathan Wrigley: Yeah.

[00:14:14] Adam Silverstein: Unfortunately it also includes scripting, which means that we don’t support it in core because of the security concerns. But it’s also very specific to like illustration type formats. That’s where it really shines. It has some big advantages. It can be styled with css. You can’t do that with other image formats. What I’m trying to get at is that each format introduced new capabilities that were important at the time.

We started to talk about modern image formats, which I include WebP in, even though it’s 12 years old at this point. What’s really cool about WebP is, it kind of combines all the features that came before. So it has the alpha transparency of PNG, but it also has the lossy compression of JPEG.

So suddenly you can take a transparent PNG and you get 80% improved compression, by making it into a transparent WebP. You still get all the features you need, the alpha transparency, but the compression is lossy now, which is impossible for we didn’t have a format that had both lossy and alpha transparency.

WebP kind of is like, essentially trying to be all the things you need. Like if we had started with WebP, we probably wouldn’t have ever needed another format, because it supports animation, it supports lossy and lossless compression, it supports alpha transparency. It also has better compression than JPEG, like 30% better on average for the same quality. So it’s a big improvement.

Then there’s a couple other formats that are upcoming, I would say. AVIF is probably the next one. It was just, support was just announced in Safari for AVIF. So Edge is the only remaining browser, major browser, that doesn’t support it. And the big promise of AVIF really over WebP is not on features, it’s just the compression that it achieves. And it’s able to achieve a 50% improvement over JPEG. So it’s very promising.

And then the one other one that’s, that’s kind of coming up that’s even newer is called JPEG XL. And this is from the same group that made JPEG and it’s just like a way, way better compression, like AVIF, but it has more affinity to JPEG so it works better with existing JPEGs. Like, it can losslessly recode existing JPEGs. The problem with JPEG XL, at least right now, is that it’s so new that it’s not really supported anywhere.

So there’s a couple things that have happened. There’s been a lot of advances in compression over the years. A lot of them actually related to video, because we’ve, we started streaming video on the web and a lot of investment went into making those compressions better. And then those, like the AVI video format is the basis, the same compression, forms the basis of AVIF, hence the naming similarity.

I’m not sure about the WebP, the history of, of like where that compression algorithm came from, but the, the goal was to create something that was better than JPEG. Higher quality at the same size, or smaller size at the same quality. You can think of it in, in either way.

[00:16:48] Nathan Wrigley: Yeah. I remember back in the day, I hate to age myself in this way, but I remember Internet Explorer six, and the enormous fun that we had with trying to get transparency and the sort of kludges that you had to.

[00:17:00] Adam Silverstein: To get it wo work?

[00:17:03] Nathan Wrigley: Yeah, a little JavaScript snippet so that you could get transparency and so on. And so that tells me that, at certain points in. history, certain image formats have not been available in browsers. Broadly speaking, there’s probably three or four browsers that the majority of people on Earth are using these days. We know what they’re called. But do they support all of these? Really, the reason I’m asking this question is, let’s say I’ve got a website and I’ve got 10,000 images on website.

And I, I now have learned that there’s a potentially 30% benefit in getting them rendered as, let’s say, WebP or, or any of the other ones that you mentioned.

[00:17:37] Adam Silverstein: Yeah.

[00:17:37] Nathan Wrigley: Would you say it’s worthwhile doing that work and re rendering them as, let’s say, WebP or something like that? Or should I just carry on and do the new formats for the new images? Or like I said, go back and redo them all?

[00:17:50] Adam Silverstein: Yeah, I mean, it probably depends on how much actual traffic you get on those older posts. I think a lot of people have older posts on their site that get very little traffic, and then I would say it’s probably not worth updating it. With the filter that we have in place in core to control the output, you can use regenerate images and regenerate all your old images.

And get that WebP benefit, like switch from JPEG to WebP for your old files. There are some caveats there. You need to make sure that the images have been inserted from the editor so that they’re actually replaced in the HTML. Because if you’re changing all your image file names, you don’t want to have broken images in your old posts.

So WordPress does do that on the fly, where we, if you insert an image from the editor, then it has like a WP image class name. So we can identify the source image and then we go and we, we build that source set into the HTML by looking at the metadata about the image. So when you do that regenerate images, it updates the metadata and therefore you’ll get the new images even in your old posts.

But that’s not guaranteed. If you have really old posts or they don’t have that WP class, and then for some reason, because you maybe built it with a page builder tool, for example, that doesn’t include those, there are scenarios where that could break your images. And all the regenerate images plugins have options around this.

Like um, WPCLI, you know, you can have it not delete the old images. So if you have URLs that are still out there referring to the old images, that’ll work. Or another example is you might have a third party site that has embedded your image. If you’re okay with that and you don’t want to break that, then you want to avoid changing your file name.

[00:19:13] Nathan Wrigley: Yeah.

[00:19:13] Adam Silverstein: So it depends a lot on your use case.

[00:19:15] Nathan Wrigley: Yeah. Caveat emptor really. Just give it a bit of thought. In terms of the browsers. What is the support like for, well obviously we know that the usual suspects that we mentioned at the beginning. The age old ones, GIFs and PNGs and JPEGs, that’s fine?

[00:19:29] Adam Silverstein: Yes.

[00:19:29] Nathan Wrigley: What about the other ones? What about the WebPs and the AVIFs and.

[00:19:33] Adam Silverstein: Yeah. So the great place to check is the, can I use website, right? They’ve got all the details but, right now WebP is supported in all the browsers, very widely supported. The only exception is older versions of Safari, and Safari support actually depends on the underlying operating system.

So this means that users have to upgrade to, I think it’s two versions ago of MacOS. So there is a small percentage of users out there that have this older Safari version that won’t load WebPs correctly. It’s actually very difficult to tell how many because there’s a bug, in like one of the subsequent versions of Safari where the user agent string misreported the OS version.

So between a couple versions of Safari and iOS or MacOS, you actually can’t tell the difference from logs. And so we don’t have good data about that in the wild, but from the data that we have, we think it’s between 1 and 2% of browser users in the world that don’t support WebP currently.

[00:20:22] Nathan Wrigley: Dare I ask, was there any politics in Safari not.

[00:20:26] Adam Silverstein: Supporting it? I don’t think so. I mean, people say, oh, it’s a, it’s a Google format. Like it’s an open source format that Google developed. But it is widely supported across a huge number of applications. There’s a lot of criticism of Safari for under investing in web capabilities.

I don’t know if this really falls into that. I do think that Apple as a company has a vested interest in keeping their app ecosystem more powerful than the web ecosystem. So I think there’s sort of some natural tension there, but I probably wouldn’t blame the Safari team. My expectation is the Safari team is all on board on making the web better.

But it’s a big corporation and there’s different interests. So there could be some political part to it, but I, not that I’m aware of. Safari, just to continue like the AVIF is sort of the next one. And Safari did just recently announce AVIF support. I think they’re just slower to adopt some things than other browsers.

[00:21:15] Nathan Wrigley: I guess if I’m using WordPress and images are a key component. I do want to be really mindful that, that number, the percentage. So you think at the moment WebP is about 98% of.

[00:21:26] Adam Silverstein: 98 to 99.

[00:21:27] Nathan Wrigley: So, at some point the Rubicon got crossed and you can say to. yourself, that’s fine. The percentage is easily high enough. I can confidently use WebP.

[00:21:35] Adam Silverstein: Yes.

[00:21:36] Nathan Wrigley: How about the other formats? Also just staying on the WebP, let’s do that bit. first. Would you recommend people to shift over to WebP henceforth?

[00:21:44] Adam Silverstein: Yes.

[00:21:44] Nathan Wrigley: Or is there, is there a good reason to stay with the older formats?

[00:21:47] Adam Silverstein: The only reason I would say not use WebP would be is if you knew most of your users were all on older Safari versions. Or you sent newsletters out to Windows users using Outlook, which is one other use case. We know that doesn’t support WebP. But this is like old versions of Outlook running on Windows. Not modern outlook.

[00:22:03] Nathan Wrigley: I guess at some point you just have to take the plunge and say there’s enough.

[00:22:07] Adam Silverstein: Yeah, Well, and we do have a support shim for Safari. So in the browser, if the page is loading WebPs, we add this little bit of JavaScript, it’s a tiny little bit that does feature detection. So it can actually detect whether the browser supports WebP. And at that point, if it doesn’t support WebP, we can actually swap the images and use the JPEGs that we do have available, We use like the next largest size that’s available. And with the current implementation, that would be either your original image or like the one of the H, high definition images that WordPress automatically creates.

So there will be, like, the primary sizes would be WebP, but there would be still be some available sizes in JPEG. If nothing else, the original image. So that means that your Safari users will still see images, they’ll just get a slower experience. So 1% of users will get a degraded experience. 99% users will get an improved experience, and then it’s up to you to decide whether it’s worth it. But at least those Safari users won’t be totally left out in the dark. They’ll still be able to see your images.

[00:23:02] Nathan Wrigley: It’s really curious. For some reason I have this atrophy and I’ve known that WebP was at about 98. And I put several images online each and every week, maybe a, a dozen or so. And for some reason I always export them as a JPEG. I haven’t managed in my own mind to say, this is now the moment. I think you’ve convinced me. I think.

[00:23:20] Adam Silverstein: Yeah. But I mean, in my opinion, like that really shouldn’t be up to users to understand that or figure that out. I mean, if you’re very technical, if you’re a photographer, maybe. But for the average WordPress user, they don’t know what image format they’re using. So this is why, it should be like a core capability where it just happens for users.

[00:23:37] Nathan Wrigley: Yeah. Okay, so WebP, that’s great. But you, you mentioned a couple of others. There was JPEG, I wanted to say JPEG 2. What was it, JPEG?

[00:23:46] Adam Silverstein: XL.

[00:23:47] Nathan Wrigley: JPEG XL.

[00:23:50] Adam Silverstein: And there’s a bunch of JPEGs actually. There was one called JPEG 2000 that you might remember that was pushed by the JPEG foundation, or organization, for a while, and that was never adopted. But yeah, let’s talk about those.

[00:23:56] Nathan Wrigley: So they, they’re presumably growing in use? Are they safe to use at the moment? Would you recommend, for example, my website using those image formats? Or Should I wait a little bit longer?

[00:24:07] Adam Silverstein: Probably wait a little bit longer, yeah. Safari doesn’t support it yet. They’ve announced support, it’s coming out and whenever the next Mac OS comes out, I think it’s like this week or something. Or it’s soon. It’s very soon. But that means that they’re just starting support so you probably want to wait till a significant number of users are actually on that version.

[00:24:23] Nathan Wrigley: Yeah.

[00:24:23] Adam Silverstein: Which in the Apple ecosystem actually happens pretty quickly. People generally, you know, there’s a very large percentage of users who will go to the next OS version very quickly. It doesn’t cost anything. And it’s like they’ve proven that it’s safe. Um, they have a pretty good uptick rate. So yeah, I mean, the only way, if you really wanted to take advantage of AVIF, we have a couple options. One is using an image CDN. So the advantage of an image CDN is that, it can actually negotiate the format.

So when browsers make a request for an image, they actually can indicate in their header, in their request headers, which formats they’re capable of decoding. And that means that the image CDN can be like, oh, you, you take AVIF? I’ll give you AVIF. That’s the best one that we have. But if it doesn’t support AVIF, okay, how about WebP? You support that? Okay. No, you don’t support any of those? We’ll give you the JPEG version. The CDN can use this capability negotiation at header time, to deliver the best image. And also they can resize the image to exactly meet the size specifications of your HTML, which WordPress doesn’t do.

WordPress generates several sizes, and then we pick the best size that’s the closest to the one that you’ve put on your page. And also we can’t do the header negotiation because we don’t handle the image requests. Those are handled by Apache or whatever web server you’re running Nginx, you know. You have a web server running, it actually handles the image request directly. WordPress has no involvement in that whatsoever. And there are plugins that do this, the only way that you can interact with that is, is using like htaccess. There are some ways to do it, but there generally outside of cores scope.

[00:25:52] Nathan Wrigley: Typically, would this CDN be the kind of thing that you would negotiate with your hosting provider?

[00:25:56] Adam Silverstein: Some hosting providers provide it. There’s of course all kinds of third party CDNs. Jetpack provides an image CDN as one example. Some of them are free, some of them are paid. I think every major CDN has a WordPress plugin that will directly integrate. So you don’t really have to do much to set it up, maybe put your login or your key in or something. So I would say like, if you can hook up with an image CDN, then you’re sort of automatically able to take advantage of the latest versions of images.

[00:26:19] Nathan Wrigley: Yeah that sounds like the way to do it, if you can stretch to that. That sounds like the best way because you can just forget about it. Everything will be taken care of.

[00:26:26] Adam Silverstein: Exactly. If you have a reason that you can’t do it or there’s a cost associated with it. Your best bet is probably to stick with WebP for now.

[00:26:31] Nathan Wrigley: Right.

[00:26:32] Adam Silverstein: Because that is so widely supported.

[00:26:33] Nathan Wrigley: On that point, are there particular types of images that you would recommend given a certain scenario? So, for example, let’s say I’m taking wildlife photography. Fairly specific example, but there’s an awful lot on the image. There’s dark areas, light areas. Lots of color. Let’s say for example, I’m creating some graphic design and it’s fairly plain, it’s text based. There’s not a lot going on in there. Is there a preferred way in, at least in your mind, or is it always WebP?

[00:26:58] Adam Silverstein: I mean, there are definitely cases where WebP like really performs better, and there’s cases where JPEG performs almost as well as WebP I guess. And even there are images where the WebP will be slightly larger than the JPEG, in certain cases to get the same quality. You know, I would say certainly if you’re doing illustration, something that’s like a line art, then if it could be an SVG, that’s probably gonna be your most efficient format.

But other than that, I think probably WebP is gonna win out on average, right? So you can look at specific images and find that maybe one would be better as JPEG, one would be better as WebP. But in general, if you take all your image is an aggregate, you’re gonna be way better off going with WebP.

I think the exception to that would be like, is if you are a photographer and what you’re showing on your website is your photography, and you want it to be like the absolute highest quality. You maybe already have changed the default quality that WordPress uses, and maybe you just want to stick with JPEG so that you know that you’re getting exactly what you’re used to. There is a visual difference between JPEG and WebP and, you know, there’s all these tools that, that they use.

I talk about it a little bit in my talk about, how do you measure quality? It’s a very subjective thing actually. There’s algorithms, so when I’m talking about how do you measure quality, So let’s say you take an image and you compress it with a JPEG and then you’re comparing it to something you’ve compressed with WebP and you say, oh, the WebP is smaller. That’s great. But it’s not that great if also the quality is lower, right? If the quality is the same and the file smaller, you win. But if the file smaller and the quality is degraded, then is that really something you want? So that you have to look at both quality and file size as two parts of the same discussion.

So it’s very interesting how we think about quality. I think, I have a slide in my talk where I have two images and there are very different compression qualities, but you actually can’t tell the difference on the screen because it’s blurry and you’re looking at a screen from 30 feet away. And the point is that it matters, the context where you’re gonna be viewing that matters. If it’s a little thumbnail, you’re not going to really matter if it’s like some pixels that are off. But if you’re looking at like that big gorgeous wildlife photography and you’re a photographer, you want the best possible quality.

[00:28:57] Nathan Wrigley: I guess it’s a case by case basis, isn’t It?

[00:29:00] Adam Silverstein: It is.

[00:29:02] Nathan Wrigley:Just suddenly occurred to me that we didn’t talk about how WordPress deals with images. We have the media library. I would imagine that’s how most people interact with their images on WordPress. You go into the media library and you upload things, drag them in and what have you. But there’s all sorts of wizardry going on right at that moment where you pull the image in for the first time. And, potentially people listening to this, they won’t know about that. So.

[00:29:20] Adam Silverstein: Sure.

[00:29:21] Nathan Wrigley: Are you able to run through that quickly?

[00:29:22] Adam Silverstein: Sure, so when you upload your image to WordPress. You’re uploading your original image, and then WordPress is gonna create a series of subsidized images. By default it has I think four, it’s actually six sizes built in. Four that you can see in the settings, or three that you can see in the settings screens. Thumbnail, medium and large. There’s also a medium large size that we added. And then there’s also two HDMI, high definition screen sizes, that are like even larger than the large size.

So when you upload your image, WordPress will go through this kind of crunching phase where it generates all of these subsidized images, and then those can be used later on the front end, depending on your context. So if it’s a thumbnail image, it’s gonna use that really small image. If it’s a larger image, it’ll use the larger one.

So we sort of pre-create these images when you upload. That process uses, uh, one of two libraries on the backend that tie into your web server. One’s called LibGD, which is now built into php. And the other one’s called ImageMagick, or people call it Image Magic. That’s like the GUI for it. And both of those libraries are available in WordPress.

We have built in image handling classes for them. I will say you can also extend the image library to add your own image handling class, but I’m not aware of specific implementations. But those are sort of the two that we support out of the box. And they’re very popular and common in php. Like I said, GD’s built into php now.

Those libraries may or may not support different formats. So getting back to your question of which format is supported. In order to be able to use AVIF with WordPress, we really need that server support. because if the server can’t read AVIF, if that means when you upload an AVIF file or you upload a JPEG and you’re trying to output AVIF, it can’t do that.

It doesn’t know how to do that. So until we get to PHP 8.1, which supports AVIF, we’re probably not going to be able to support directly AVIF in WordPress. So there’s that server dependency that you have. And also, just to add a little wrinkle to that is that, GD supports WebP or, you know, Imagemagick supports AVIF, but only if it’s built with that. So literally at compile time, someone has to build the web server, right? It’s written in C or whatever assembly, like whatever code it’s written in, and then someone has to compile and they have to decide, am I including the AVIF i library? Am I including the WebP library? And so whether you have support for those depends on your host.

Like what is their hosting stack, what is the distribution that they’re using? It’s a wide variety of things out there. But yeah, that’s the general process. You upload, the images get generated, and then, when you insert the image into your post WordPress will use all of those images. They’ll use it in the source set to build out the responsive design.

[00:31:48] Nathan Wrigley: As with all things WordPress there’s plugins that step in and do additional features. I mean you can code this yourself but you know, you can create other image sizes that WordPress will create on the fly, soon as you, you know, you crunch an image. Yeah, but also there’s this curious third party industry of image s smushing, I want to call it. You know where, when it’s uploaded, and I believe also WordPress itself now has a maximum, you know, if you’ve got a vanilla install of WordPress there’s a, what is it? What’s the.

[00:32:15] Adam Silverstein: It’s It’s like a max threshold size for image uploads.

[00:32:18] Nathan Wrigley: Yeah. That, I suppose is a useful thing to talk about. The idea that, okay, so you’ve got this brand new beautiful camera, which is taking images.

[00:32:27] Adam Silverstein: Sixteen megapixels.

[00:32:27] Nathan Wrigley: Right, and honestly you’ve got a 10 megabyte image but you’re intending to display it as a thumbnail in the corner of your post or something like that.

[00:32:34] Adam Silverstein: Right?

[00:32:35] Nathan Wrigley: The intention, therefore, from these third party plugins and, and what have you, is to take that image and just reduce it. Make it teeny tiny. Why do we do that? What’s the benefit to begin there? You talked about bandwidth and all of that earlier. Is that the only reason that we’re doing, it’s just to save on bandwidth?

[00:32:52] Adam Silverstein: And to speed up the loading of the page.

[00:32:53] Nathan Wrigley: Right.

[00:32:54] Adam Silverstein: So, and just to Expand on that. It’s not really just about the speed of the page, but it’s about the experience of your users visiting your website. If you have slow images that are too large for what you need, then you are giving your users a poor experience. There’s all kinds of studies that show that by improving the loading time and responsiveness of your website, you get better results. So whatever those goals may be, conversions into newsletter subscribers or people who purchase products, or someone who reads more than one article on your website. Those things are all enhanced by having a better user experience. And so if we’re talking about optimizing images, we’re really talking about creating a better user experience.

[00:33:33] Nathan Wrigley: You’re wearing your Google t-shirt today.

[00:33:35] Adam Silverstein: Yeah.

[00:33:35] Nathan Wrigley: So you know you’re doing all all the right things.

[00:33:37] Adam Silverstein: Google google loves open source.

[00:33:39] Nathan Wrigley: You are not on the search team, so maybe this question is not gonna be one that’s right in your wheelhouse, but I’m gonna ask it anyway. SEO and search engine results. I’m presuming there is a benefit because you know, in the last couple of years we’ve all been thinking about Core Web Vitals and that’s been a big push from Google, and everybody’s taken that very seriously.

[00:33:56] Adam Silverstein: Yes.

[00:33:56] Nathan Wrigley: And, you know, is there a benefit to your search position, should you take the time to do images right?

[00:34:04] Adam Silverstein: Yes, and I’ll say that it’s only really a very small benefit. Really what gets you the best position in search results is having the best content. And if I have an article about Bartlett pears growing in San Diego and someone Googles it, and I’m the only article about that on the web, they’re gonna go right to me. No matter how performant my site is. Where performance comes in is as a waiting factor, like many, many other factors as a signal to Google. Just like HTTPS, mobile support. These are all signals that Google has announced.

But, uh, you’re not gonna be like, penalized for poor performance. It’s more that if all other things are equal, this could be a weighting factor that would bump you up, having a better experience for your users. But that really shouldn’t be your motivation. Your motivation should be creating a better experience for your users first, and then secondly better achieving your goals once people reach your site.

So someone described it as a funnel, right? People think of web conversions as a funnel. You start at the top, all the people who see your search results, and then it gets smaller. All the people who click on your search results. And then, all the people who actually do something on your website. And then finally, this tiny, small number of people that convert to being paying customers. And I, and in my hands here just for audio, I’m going from wide to smaller. And where the user experience parts helps, uh, improving user pitch is not up here at the top in getting more search results. It’s here where once users reach your site, then you’re gonna really see that benefit. And so, that’s where you should think about where the benefit comes. It comes from turning those visiting users into actual, whatever your goal is.

[00:35:36] Nathan Wrigley: Okay, I’m gonna go slightly off piste. Google does a fantastic job. I use Google photos, and Google Photos is able to identify the objects in my photos. And so I did wonder if there was a potential Google search. So, for example if I have a website I don’t label, I don’t put any metadata on my images at all. Does Google do any of that? This website is full of trees, and so if I search for a particular tree.

[00:36:05] Adam Silverstein: That’s a really good question. I don’t know the answer. I would say, first of all, please put alt tags on your images. Don’t do that. Because there’s a reason we have alt tags. Actually someone, so it’s the reason, the big reason is of course, accessibility, right. People who are visually impaired can’t see your images. It’s nice if they have a description of what they’re missing.

Someone actually today came by and said, do you think there’s a way we could take image recognition and make it so that non sighted users touch over the image, they get a description of what they’re seeing. So, if you’re a non sight user, I don’t know if you’ve ever seen people, a lot of times they actually use a touchscreen that’s haptic.

[00:36:37] Nathan Wrigley: Yeah.

[00:36:38] Adam Silverstein: So they can move over and they can feel the buttons, right. It’s not just, having the buttons described to them in text, but literally a screen that as you’re moving over elements of the page, it bumps up. So you can actually feel, oh, there’s a button. That’s where the home button is, and then they can tap it, right? So they already have this technology, screens that are like this, and of course visually impair people are, are often used to reading braille, so they’re very sensitive with their fingers.

So imagine something where you have a picture of trees and a person and a visually impaired person could move their hand over and say like, oh, there’s the person and there’s trees back here, and they’re feeling the image. Like that would be amazing. And that would again, require that same visual recognition of images.

[00:37:12] Nathan Wrigley: That is a truly, astonishingly good idea.

[00:37:14] Adam Silverstein: Right, I had never heard that idea.

[00:37:16] Nathan Wrigley: That is just mind blowingly clever. Let’s hope that somebody can build that.

[00:37:21] Adam Silverstein: Yeah. There was another, just one more that someone posted recently to Twitter, you might have seen, but it’s the, it’s like the DALL E tools that are out now with the image generation. So someone has built a WordPress plugin in Gutenberg where you type in, like you’re working on your post and it’s about Bartlett pears in San Diego. So you type in like Bartletts flying across the San Diego Bay, and it generates an image for you of that. You’re there in Gutenberg and you just insert it.

[00:37:45] Nathan Wrigley: The whole AI piece. Rewind the clock just two years, and I thought it was, no, this is going nowhere.

[00:37:51] Adam Silverstein: Right.

[00:37:51] Nathan Wrigley: At no point in the future will you be able to tell a computer to create an image or a piece of art, or replicate, well, almost anything, but especially the things which don’t exist. You know, the triangle dog or whatever it might be.

[00:38:04] Adam Silverstein: Yeah.

[00:38:05] Nathan Wrigley: And, and yet you input it in and just in the space of two years, it’s gone me laughing at it. To me, just being in awe of it.

[00:38:13] Adam Silverstein: It’s amazing.

[00:38:14] Nathan Wrigley: It’s truly amazing.

[00:38:15] Adam Silverstein: Yeah, so I use one of those tools to generate all the images in my slideshow for my presentation yesterday. So I have like hilarious images, like a raccoon surf boarding and a, a goat driving a race car.

[00:38:25] Nathan Wrigley: Yeah.

[00:38:26] Adam Silverstein: Impossible things, but they look, you know, if you look closely, you can see some weird details. They’re very, very accurate.

[00:38:32] Nathan Wrigley: There’s lots of them as well. I believe the one that captured my attention recently, I think it was called Mind Journey or something like. It’s implementation is to create art.

[00:38:43] Adam Silverstein: Right.

[00:38:43] Nathan Wrigley: So you give it the, the thing that you feed it is, I don’t know, I’d like a picture of a sunset that resembles Rembrandt, with a red sky to the left and so on. And it completely does it.

[00:38:54] Adam Silverstein: That’s amazing.

[00:38:54] Nathan Wrigley: Yeah, an absolute miracle. Adam Silverstein, thank you so much for joining me on the podcast today. I really appreciate it.

[00:39:00] Adam Silverstein: It was fun. Thank you.

On the podcast today we have Adam Silverstein.

Adam is a WordPress core comitter where he works to fix bugs and improve modern web capabilities. As a Developer Relations Engineer in the content ecosystem team at Google, he works to invigorate the open web by empowering and educating developers.

At the recent WordCamp US, he gave a presentation entitled ‘Images on the Web – past present and future’. In it, he outlined his thoughts on where the web is going in terms of support for different image formats.

Alongside text, images are the bedrock of webpages. We browse the internet and expect pages to have images of all forms. Photos, illustrations, charts and images to convey additional meaning to the text.

But how do the images actually get on the page? WordPress makes handling images pretty easy, and Adam explains what happens when you upload an image to the Media Library, and then display it on a page or post in a browser.

We discuss the fact that different image sizes are created automatically by WordPress, which can be used in a variety of contexts across your website. You’ve likely heard of many of them, but perhaps you have not thought about which format belongs where.

As with code, the technology behind images does not stand still. New formats are being created all the time and are being supported at differing rates by the major browser vendors. In the past we typically used JPEG, GIF or PNG files to display images on our websites, but there’s good reason to think about adopting other defaults in the near future.

We discuss some of these new formats, such as WebP, AVIF and JPEG XL, and find out about how they are speeding up website loading times because of their smaller file sizes.

We also get into how you can optimise your images, and how plugins and SaaS solutions can reduce the size of your files before or after you upload them to your WordPress install.

Adam has some good advice about a topic which is becoming increasingly important, page load time, and if you’ve never given this serious thought, this is a great podcast episode for you.

Typically, when we record the podcast, there’s not a lot of background noise, but that’s not always the case. Over the coming weeks, I’ll be bringing you recordings from a recent trip to WordCamp US 2022, and you might notice that the recordings have a little echo or other strange audio artefacts. Whilst the podcasts are more than listenable, I hope you understand that the vagaries of the real world were at play.

Useful links.

Jukebox Podcast episode 34 – Felix Arntz on WordPress and Performance

Can I Use website

LibGD graphics library

New Block Diffusion Plugin Creates AI-Generated Images from Text Prompts

Midjourney

How to Make a Folder “Slit” Effect With CSS

When you put something — say a regular sheet of paper — in a manilla folder, a part of that thing might peek out of the folder a little bit. The same sort of thing with a wallet and credit cards. The cards poke out just a smidge so you can get a quick glance of which cards you’re carrying.

Credit: Stephen Phillips on Unsplash

I call this sort of thing a “slit”. A slit is where we create the illusion of an opening through which we can tease a visual element peeking out of it. And we can do that in CSS!

The crucial part of the design is the shadow, which is what gives the visual cue of there being a slit. Then there’s the cover for the slit which provides the space for the exhibited element to peek through from under.

Here’s what we’re going to make together:

Let’s begin with creating the shadow

You might be surprised that the shadow in the example is not created with an actual CSS shadow, like box-shadow or a drop-shadow() filter. Instead, the shadow is a separate element in itself, dark and blurred out. This is important in order to make the design more adaptable, both in its default and animated states.

The cover is the other element in the design. The cover is what I call the element that overlaps the shadow. Here’s a figure depicting how the shadow and cover come together.

The shadow is made from a small upright rectangle that has a gradient background. The gradient is darker in the middle. So when the element is blurred, it creates a shadow that’s darker in the middle; hence more dimensional.

Now, the left half of the recreated shadow is covered with a rectangle on top, colored exactly the same as the background of its container.

Both the cover and the shadow are then moved to the left ever so slightly so it appears to be layered

Working on the cover

For the cover to blend with the design’s background, its background color is inherited from its containing element. Alternatively, you can also try to blend the cover to its background using standards like CSS masks and blend modes, depending on your design choices and requirements.

To learn some basics on how these standards might be applied, you can refer to these articles: Sarah Drasner’s “Masking vs. Clipping: When to Use Each” provides an excellent primer on masks. I’ve also written about CSS blend modes in this article where you can brush up on the topic.

In the source code of my example, you’ll notice that I aligned and stacked the elements inside the <main> element using CSS Grid, which is a layout standard I often use in my demos. If you’re recreating a similar design, use a layout method that fits the best for your application to align the different parts of the design. In this case, I’ve set up a single-column grid on the <main> element which allows me to center align the cover, shadow, and image.

What CSS Grid also allows me to do is set all three of those divs so they are all full-width in the <main> container:

main > div {
  grid-area: 1 / 1;
}

This gets everything to stack on top of one another. Normally, we work hard to avoid covering elements with other elements in a grid. But this example relies on it. I’ve given the .slit-cover at width of 50% which naturally reveals the image underneath it. From there, I set a transform on it that moves it 50% in the negative direction, plus the small amount I shifted the shadow earlier (25px) to make sure that is revealed as well.

.slit-cover {
  width: 50%;
  transform: translatex(calc(-50% - 25px));
  /* etc. */
}

And there we have it! A pretty natural-looking slit that mimics something peeking out of a folder, wallet, or whatever.

There are more ways to do this! For one, Flexbox can get elements to line up in a row and align in the center like this. There are lots of ways to get things side-by-side. And maybe you have a way to use the box-shadow property, drop-shadow() filter, or even SVG filters to get the same sort of shadow effect that really sells the illusion.

And you can totally riff on this to get your own look and feel. For example, try swapping the position of the shadow and image. Or play with the color combinations and change the blur() filter value. The shape of the cover and the shadow can also be tweaked — I bet you can create a curved shadow instead of a straight one and share it with us in the comments!


How to Make a Folder “Slit” Effect With CSS originally published on CSS-Tricks, which is part of the DigitalOcean family. You should get the newsletter.

Understanding Privacy: A New Smashing Book Is Here

To many of us, privacy might feel like a complex, abstract concept. We can’t hold privacy in our hands, we can’t touch it, we can’t explore its volume or shape with our eyes or our fingertips. Surely it’s a part of each of us, yet it feels so intangible and so invisible — beyond reach and out of view.

So what is privacy? What exactly does it mean? How do we consider, manage and maintain privacy? And how dow do we design and build experiences that have privacy at their heart? That’s exactly what Understanding Privacy is all about: a practical guide to privacy on the web, from data collection and use of personal data to creating safe, inclusive experiences for everyone. Jump to table of contents ↓

About The Book

Understanding Privacy is a practical guide to the concepts and ideas that inform privacy on the web. It’s about all the fundamental values of privacy as a concept, which precede privacy as a legal compliance issue. It’s about the ways these concepts impact your work as a designer, a developer, or a project manager. And it’s about the ways you can adopt these principles to create a healthy, user-centric approach to privacy in everything you do.

Heather Burns, a tech policy and regulation specialist, explains what she has experienced working on privacy from every angle — human rights, law, policy, and web development — in the simplest way possible, and in the most positive way possible, in ways you can understand, use, and adapt in your work on the web right away.

All chapters in the book have custom illustrations, highlighting the topic of the book.

This book is not a legal reference manual. After reading it, you will have shifted your understanding from a negative view of privacy as a scary legal compliance obligation to a positive view of privacy as an opportunity to build and design a better web. Download a free PDF sample (11MB).

288 pages. Written by Heather Burns. Cover design by Espen Brunborg. eBook now available, print shipping in November.

You’ll Learn:
  • Fundamental concepts, definitions and frameworks behind privacy and data protection,
  • Healthy approach to user privacy into everything you build and design,
  • Common privacy issues and how you can make a difference,
  • How to lay the ground for future developers, designers, and project managers to build a better web for tomorrow,
  • The obligations we have to safeguard user privacy and health data.

Who Is This Book For?

Understanding Privacy is for designers, developers, and project managers who want to understand what privacy really is about and who want to integrate a healthy approach to user privacy into everything they do not only to put their users first today but also to help build a better web for tomorrow.

A double-spread of Understanding: an honest, practical and clear guide to privacy. Table Of Contents
1. Privacy and You
+

In the book’s first section, “Privacy and You,” Heather reviews the fundamental concepts, definitions and frameworks behind privacy and data protection.

2. Privacy and Your Work
+

In the second section, “Privacy and Your Work,” Heather discusses how to integrate a healthy approach to user privacy into everything you do, whether you are a designer, a developer, or a project manager.

3. Privacy and Your Users
+

“Privacy and Your Users” covers issues around user privacy where you can make a difference. We’re going to learn how to consider the power dynamics of what you create, regardless of the role you play.

4. Privacy and Your Future
+

In “Privacy and Your Future,” Heather suggests a few critical areas that make the web a better place and lay the ground for future developers, designers, and project managers to build a better web for tomorrow’s users.

Postscript: Privacy and Health Data
+

In the final section, “Privacy and Health Data,” Heather addresses an even more pressing recent issue: the obligations we have to safeguard user privacy and health data, and how to do it as best we can.

288 pages. eBook now available, print shipping in November. Written by Heather Burns. Cover design by Espen Brunborg.

About the Author

Heather Burns (@WebDevLaw) is a tech policy professional and an advocate for an open Internet which upholds the human rights to privacy, accessibility, and freedom of expression. She’s been passionate about privacy since she built her first web site in 1996, and has educated thousands of professionals worldwide on the fundamentals of a healthy approach to protecting people and their data. She lives in Glasgow, Scotland.

The book comes with practical guidelines and checklists to keep in mind when designing and building with privacy in mind. Reviews and Testimonials
“Heather's broad knowledge, experience, and ability to articulate these complex matters is nothing short of astounding. I’ve learned an amazing amount from her. She always informs and entertains, and she does so from the heart.”

Mike Little, Co-Founder of WordPress
“No more excuses for overlooking privacy: Heather’s guide is an essential toolbox for user-centric product developers and for anyone interested in building a better web. Expect the full sweep, from historical context and core concepts in US and EU privacy practice, to practical tips and advice — dispensed in highly readable style.”

Natasha Lomas, Senior Reporter, Techcrunch.com
“Privacy is an oft-talked about and rarely understood part of our modern digital lives. Heather has been on the forefront for the battle of our privacy for decades. In this book she makes the case for why privacy is one of the foundational pillars on which our society rests, and why eroding our privacy means eroding a cornerstone of our lives, our communities, and our democracy. A must-read for anyone working on or with the web.”

Morten Rand-Hendriksen, Senior Staff Instructor, LinkedIn Learning
“Privacy can seem complicated but it doesn’t need to be. Heather covers all that you need to know with astonishing clarity. This book gives you all you need to understand and handle privacy work, and makes for great teaching material that experts could rely on.”

Robin Berjon, former Head of Data Governance at The New York Times
Technical Details
  • ISBN: 978-3-945749-64-7 (print)
  • Quality hardcover, stitched binding, ribbon page marker.
  • Free worldwide shipping from Germany, starting in November 2022.
  • eBook is already available as PDF, ePUB, and Amazon Kindle.
  • Get the book (Print Hardcover + eBook)
Community Matters ❤️

Producing a book takes quite a bit of time, and we couldn’t pull it off without the support of our wonderful community. A huge shout-out to Smashing Members for the kind, ongoing support. The eBook is and always will be free for Smashing Members. Plus, Members get a friendly discount when purchasing their printed copy. Just sayin’! ;-)

More Smashing Books & Goodies

Promoting best practices and providing you with practical tips to master your daily coding and design challenges has always been (and will be) at the core of everything we do at Smashing.

In the past few years, we were very lucky to have worked together with some talented, caring people from the web community to publish their wealth of experience as printed books that stand the test of time. Steven and Stefan are two of these people. Have you checked out their books already?

Touch Design for Mobile Interfaces

How touchscreen devices work and how people use them.

Add to cart $44

TypeScript In 50 Lessons

Everything about TypeScript, its type system and its benefits.

Add to cart $44

Smart Interface Design Patterns

Deck of 166 cards with common UX questions to ask.

Add to cart $39

UI Interactions & Animations Roundup #26

NFT Accelerator – Interaction

by THRC

Prism – Store

by Ruslan Siiz

Gamma

by Robin Noguier

material. | Story

by Ivan Gorbunov

Progressive Moments

by Ali Zafar Iqbal

3D Animation in Interface

by Barry

Mail App

by Slava Kornilov

Uprock Agency. New concept

by Evgeny UPROCK

Visual Creatures Folio

by Zhenya Rynzhuk

BX Films — Redesign Concept

by Evgeny UPROCK

Mobile House Website Animation

by Vito Burhonski

Sneakers Presentation

by Vito Burhonski

SASI Studio – redesign corporate website

by Evgeny UPROCK

Photo App

by Slava Kornilov

MUSIC STORE WEBSITE CONCEPT

by Vitalii Burhonskyi

Virtually Human

by Slava Kornilov

Acid Kinetic Typography

by Anastasiia Malai

Gore – Product Landing Page Animation

by Bayu Ananda

Elegant Design Studio Website Home Page Animation

by Pradeep kumar

ANNIE LEIBOVITZ

by Evgeny UPROCK

Cuberto Development Dept

by Cuberto

Nearest Neighbor Embeddings Search With Qdrant and FiftyOne

Neural network embeddings are a low-dimensional representation of input data that gives rise to various applications. Embeddings have some interesting capabilities, as they can capture the semantics of the data points. This is especially useful for unstructured data like images and videos so that you can encode not only pixel similarities but also some more complex relationships.

Embeddings from the BDD100K dataset were visualized using FiftyOne and Plotly.

Performing searches over these embeddings gives rise to many use cases like classification, building up recommendation systems, or even anomaly detection. One of the primary benefits of performing a nearest-neighbor search on embeddings to accomplish these tasks is that there is no need to create a custom network for every new problem; you can often use pre-trained models. Using the embeddings generated by some publicly available models is possible
without any further finetuning.

How to Use AI to Generate Images in WordPress

Do you want to use artificial intelligence tools like DALL.E to generate images in WordPress?

AI-generated images can be a good alternative to create images for your WordPress blog posts without worrying about copyright.

In this article, we will show you how to use AI to generate images in WordPress.

Using AI tools like DALL.E to make images for WordPress websites

Why Use AI Tools to Generate Images for Your WordPress Website?

There are a ton of paid stock image websites offering images to use on your WordPress website for a small fee.

However, the cost of these images is an extra expense. Most bloggers and small businesses don’t have the budget for that.

There are certainly many websites that offer royalty-free images like Unsplash or Shutterstock‘s limited free library.

But those images are highly overused and often too generic.

Now, the best way to create images for your website is by making your own images or using your own photographs. But not everyone is a professional photographer or digital artist.

This is where artificial intelligence comes in.

AI tools like DALL.E can generate unique artwork from text descriptions provided by the users.

These images are not only unique but highly creative and artistic.

For instance, here is an image of an office desk with a sunset backdrop generated by DALL.E 2. It mimics the style of generic stock image photos that you can find on hundreds of websites.

DALL.E 2 mimicking generic stock photo style

Now, take a look at this example of an artwork created by DALLE.2.

This one is artistic, more colorful, and in a comic book style.

DALL.E comic book style artwork

You can see the variety of styles, topics, and ideas you can use on the DALL.E homepage.

The best part is that you are free to use these images for your blog posts, articles, and even landing pages.

That being said, let’s take a look at how to easily use AI-generated images in WordPress.

We will be showing you three methods using three different AI tools; you can choose one that works best for you by clicking on the quick links below:

1. Generate AI Images for WordPress with DALL.E 2

DALL.E 2 is an artificial intelligence tool made by OpenAI. It is quite popular for its artistic rendering, surrealism, creativity, and versatility.

Built on the GPT-3, it is a text-to-image model using deep learning technologies to generate images from natural language descriptions.

It is similar to ChatGPT, which also uses GPT-3 but responds in text. In the generative AI industry, these descriptions are called prompts.

You can create AI images on the DALL.E 2 website and download them to your computer. After that, you can upload those images to your WordPress website.

First, you need to visit the DALL.E 2 website and sign up for a free account, which gives you 50 credits for your first month.

Upon signing up, you’ll see the DALL.E dashboard with a prompt field and some recent artworks generated by DALL.E.

DALL-E dashboard

In the prompt field, type a text description of the image you want to generate. You can be as descriptive and creative as you like.

Click on the ‘Surprise Me’ button to see some examples of prompts you can generate.

Once you click on the ‘Generate’ button, the AI will generate images based on the prompt you provided and show you four results.

Images generated using the prompt

You can download all of them to your computer if you want. You can also click on any of the generated images to edit them.

The image editor in DALL.E allows you to expand the frame or pan in. You can also erase or retouch an area of the image.

Edit image in DALL.E 2

Click on the ‘Generate’ button again for AI to regenerate the image based on your changes.

Once you have downloaded the images to your computer, you can switch back to the admin area of your WordPress website.

You can now upload the image to your WordPress media library by visiting the Media » Add New page.

Upload image to WordPress media library

You can also add an image directly to your WordPress posts and pages. Simply edit the post or page where you want to display the image.

On the post edit screen, add the Image block and then upload the image from your computer.

Adding image to WordPress post and pages

Automatically Generate AI Images in WordPress with DALL.E and Uncanny Automator

If you are looking for a plugin to integrate DALL.E 2 directly with your WordPress website, then you can use Uncanny Automator.

Uncanny Automator is one of the best WordPress automation tools on the market. It offers support for OpenAI’s GPT and DALL-E models to easily generate AI text content and images in WordPress.

You can use the simple recipe builder to create an automation that uses a WPForms submission form to send text and image prompts to GPT and DALL-E.

Send OpenAI text and image prompts using a submission form with Uncanny Automator

Then, you can create a new post in WordPress using Uncanny Automator’s tokens to automatically pull the data from the text and image generation.

For example, you can use a response token to set the featured image as the AI image you created:

Use Uncanny Automator action token to set featured image as AI generated image

This will turn the text and image prompts from your submission form into a new blog post in just a few clicks.

Uncanny Automator even adds the DALL-E image directly to your WordPress media library, so you don’t need to do it manually.

AI generated blog text and featured image using Uncanny Automator

For more details, see our guide on how to create automated workflows in WordPress with Uncanny Automator.

What is the License Used for Images Generated by DALL.E 2?

You retain the copyright for the images generated by the prompt you provided to DALL.E 2.

You can use the images anywhere you want, including your WordPress website, YouTube videos, eBooks, magazines, and more.

2. Use SeedProd to Generate AI Images in WordPress (Premium Plugin)

For the first method, we will use SeedProd to easily generate AI images in WordPress.

SeedProd is the best drag-and-drop theme builder for WordPress. It allows you to create custom WordPress themes, page layouts, and landing pages without coding.

It also comes with a powerful AI Assistant that uses DALL-E to help you generate AI images in just a few clicks.

To get started, you need to install and activate the SeedProd plugin. If you need help, see our guide on how to install a WordPress plugin.

Note: There is a free version of SeedProd available. However, you need to buy the premium version of SeedProd to access the AI Assistant. You’ll also need to buy AI credits by clicking the link in your SeedProd account dashboard.

Once the plugin is activated, you can use the drag-and-drop builder to create a custom WordPress theme or landing page. For step-by-step instructions, you can follow our tutorials:

Then, you can use the AI Assistant to generate original images for your website pages.

Simply edit the page, drag an Image block from the panel on the left-hand side, and drop it into the live preview area on the right.

Add an Image block in SeedProd

Next, click on the Image block to open up the block settings panel on the left side of the screen.

Then, click on the ‘Add with AI’ button.

Click the Add with AI button

This will open the image prompt panel. Here, you can type a description of the image you want to create for your site or use one of the suggested prompts.

After that, click on the ‘Generate Image’ button.

Type a description of the image you want to generate

SeedProd will take a few seconds to generate the image.

When it’s done, you’ll see a preview of the image, and you can click the ‘Insert’ button to add it to your page.

Insert the AI image generated by SeedProd

After the image has been added to your page, you can also edit the AI image and generate variations of the same image.

Just click on the generated image from the SeedProd builder and select ‘Edit with AI’ in the block settings panel.

Edit image with AI

Next, you’ll see the different editing options that are available.

First, click on the ‘Variations’ button.

Options for editing AI generated images with SeedProd

From there, hit the ‘Generate Variations’ button.

This will tell the AI Assistant to create multiple variations of the image.

Click the Generate Variations button

If you like one of the variations better than the original AI-generated image, you can click the ‘Insert’ button to add it to your page.

Otherwise, you can select the ‘Back’ button to keep the original image and return to the edit options screen.

SeedProd will create multiple variations of your AI image

The ‘Edit Image’ option allows you to use a brush tool to edit specific areas of the image. Simply erase the area that you want to edit and alter your original prompt to describe the changes you want to make.

Then, click the ‘Generate new image’ button.

Erase an area of the AI image and edit it with a new prompt

After a few seconds, SeedProd’s AI Assistant will show you two variations of the image with the changes you described.

You can click on the ‘Insert’ button underneath the variation you like the most to add it to your page.

Insert edited AI image

Once you are happy with the image, just hit the ‘Save’ and ‘Publish’ buttons.

You can find them in the top right corner of the SeedProd builder.

Save and publish your changes

Now, your AI-generated image will be displayed on your WordPress website.

Here’s how it looked on our demo site:

Example of AI generated image created with SeedProd

What is the License Used for Images Generated by SeedProd?

You own the images you create with SeedProd’s AI Assistant.

You’re free to use the AI-generated images anywhere on your WordPress site.

3. Use Imajinn to Generate AI Images in WordPress (Free Plugin)

For this method, we will use Imajinn AI to generate images in WordPress.

Imajinn AI is similar to tools like DALL.E 2, Midjourney, and Stable Diffusion. It generates images using artificial intelligence based on the prompt you provide.

First, you need to install and activate the Imajinn plugin. For more details, see our step-by-step guide on how to install a WordPress plugin.

Note: The base plugin is free and gives you 10 credits. After that, you can buy more credits from the plugin’s website.

Upon activation, you need to visit the Media » Imajinn AI to configure plugin settings and generate images.

First, you need to sign up by providing an email address and password to create your account.

Register free account

After that, you will be able to start generating images using Imajin AI.

Simply provide a detailed prompt describing the image that you want to generate.

You can also choose from a list of styles, artist style, style modifier filters, and aspect ratio to further customize your prompt.

Image prompt

Below that you can choose to click on the ‘Summon’ button to launch the Prompt Genie tool.

The tool will suggest further prompt ideas based on the prompt description you provided to generate the best possible image.

Prompt genie

You can click on the ‘Generate’ button to use a suggested prompt, or continue writing your own prompt by copying ideas from the suggestions.

Once you are satisfied, click on the ‘Generate’ button to continue.

The plugin will now start generating images using the AI tool running on the cloud. Once finished, it will display four variations of images for you to choose from.

Imajinn generated images

Below each image, you’ll find options to share the image, repair faces (The AI is not great at generating human faces), or touch up the image.

You can also just click on the ‘Save’ button to store an image in your WordPress media library.

image toolbar

To use the image in your WordPress posts and pages, simply edit the post or page where you want to add the image.

On the post-edit screen, add the Image block where you want to display the image and then click on Media Library.

Adding image to your post and pages

Next, you need to select the image you saved earlier from your Media Library and provide an alt text for the image.

After that, go ahead and click on the ‘Select’ button to insert the image.

Image added to WordPress post

The plugin also comes with an Imajinn block that you can add to your posts or pages.

It allows you to generate an image inside the block editor.

Imajinn block

What is the License Used for Images Generated by Imajinn AI?

All images generated by Imajinn AI are provided under the free domain or CC0 license.

You are free to use them on your website as you see fit.

Bonus Resources:

AI can be used to help you write content, create images, and more. Here are some more resources to upgrade your AI skills:

We hope this article helped you learn how to use Artificial Intelligence to generate images for your WordPress website. You may also want to see our ultimate image SEO guide and these easy tips to optimize images for speed.

If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.

The post How to Use AI to Generate Images in WordPress first appeared on WPBeginner.

7 Full Site Editing WordPress Themes for 2022

WordPress has undergone quite a few changes as of late. In the past few years alone, there have been major updates to WordPress core, changing how people interact with the CMS in major ways. The biggest innovation is the addition of full site editing to WordPress. We’ve already gotten acquainted with Gutenberg and how the Block Editor has transformed the way blog posts and pages are created. But now, the aim is to adjust how we customize entire websites from within WordPress as well.

And while this might sound a bit scary at first, rest assured, there are still plenty of WordPress themes created every day that incorporate this new feature and make it easier than ever to design and customize websites in WordPress.

That’s precisely what our focus will be here today. Let’s take a look at 7 full site enabled WordPress themes that make full site editing accessible and familiar.

Your Designer Toolbox Unlimited Downloads: 500,000+ Web Templates, Icon Sets, Themes & Design Assets

Twenty Twenty-Two

Twenty Twenty-Two Full Site Editing Theme

The TwentyTwenty-Two WordPress theme was created with the belief that everyone deserves a website that is truly one-of-a-kind. The theme’s understated styles take inspiration from birds, which are themselves known for their diversity and versatility. The typography in the theme is light yet strong, the color palette is inspired by nature, and the layout elements are designed to sit gently on the page.

Twenty-Two is meant to be easily customizable, taking advantage of WordPress 5.9 Full Site Editing capabilities. This means that the colors, typefaces, and site layout of each individual page on your site can all be altered to match your preferences. It also includes several block patterns for you to use in creating professionally designed layouts with just a few clicks.

Catch FSE

Catch FSE

Catch FSE is a responsive, minimal WordPress theme with a dark or light color scheme. It’s been created using Twenty Twenty-Two and is ideal for blogs and corporate sites, alike. You can select your site color style in WordPress 6.0’s Global Styles feature and start creating your content with the easy drag-and-drop interface by utilizing block patterns.

It’s free and easy to use, with a clean, modern aesthetic. It allows you to create a distinctive site by providing 15 distinct block patterns, 15 FSE Templates, and 9 Template Parts so you can build your own website the way you want it.

Bricksy

Bricksy Full Site Editing WordPress Theme

Bricksy is perfect for those who want to build their own modern website without having to code or design from scratch. With an easy drag-and-drop interface, you can use the premade block patterns to create beautiful pages in minutes.

The theme takes full advantage of WordPress’ Full Site Editing features, making it easier than ever to create a professional site that looks great and functions as you want – no compromises required.

Allele

Allele Full Site Editing WordPress Theme

Allele is a WordPress theme that comes with pre-defined block patterns and full-page templates. It has a modern, clean design and provides full site editing support. This theme is perfect for creating professional websites that need to be edited often.

Other features of this theme include support for multiple languages and RTL, it’s accessibility-ready, it’s SEO friendly, and it’s lightweight, too.

Avant-Garde

Avant-Garde Full Site Editing WordPress Theme

Avant-Garde is a simple, experimental block theme for WordPress. It features an easy-to-use interface and a minimal design, perfect for those who want a streamlined blog or website.

The theme is fully responsive and retina-ready, ensuring that your content looks great on any device. Avant-Garde is also translation-ready and supports the WPML plugin, making it easy to create a multilingual website.

The simple design here would lend itself well to a wide variety of content types and topics. And, if you’re wanting to experiment with a new design direction for your website, Avant-Garde could be the perfect theme to help you do just that.

Frost

Frost

The Frost WordPress theme is a well-designed and feature-rich theme that can be used for a variety of website types. The theme includes a hero section with an image and text, as well as a portfolio section to showcase your work. The theme also includes calls-to-action, testimonials, and more.

This versatile, mobile-optimized WordPress theme makes it easy for designers, developers, and creators to build a sophisticated website in minutes. With a user-friendly interface and a wide range of features, Frost is perfect for anyone who wants to create a powerful online presence.

Wabi

Wabi

Wabi is a WordPress block theme created to assist you in telling your story in the most effective way possible. The clean lines, beautiful typefaces, and dynamic accent color system used to aid with your storytelling. This is all further emphasized through the use of simple curves and lovely letterforms. Wabi comes with three different style variants (light, dark, and dynamics) for maximum expressiveness and flexibility.

Which Full Site Editing WordPress Theme Will Serve Your Next Project?

These are only a few of the hundreds of Full Site Editing WordPress themes available. But hopefully, this gives you a starting point for finding the perfect one for your next project. Good luck!