99

Update on the URL migration, May 15th 2024

The work described below will be under way shortly. For further updates, we'll be maintaining the update log in the main post for the Imgur migration.


We're moving into the next phase of our work to replace Imgur with our new in-house image hosting service. All image uploaders network-wide now use our new image hosting service, and so our work is nearing completion.

Starting the week of May 13, 2024, we'll begin rolling out updates to replace Imgur links with the new i.sstatic.net domain we develop and maintain.

What's changing

We will be updating Imgur URLs appearing in post bodies, comments, chat posts, and other significant text fields across the network. The URLs will change in the following way.

Old Imgur image URL format:

https://​​i.stack.imgur.com/<image ID>.<extension>

New self-hosted image URL format:

https://i.sstatic.net/<same image ID>.<extension>
  • We'll update rows of data containing valid Imgur URLs: i.e. https://i.sstatic.net/0000Q.png

  • We'll be replacing the actual domain portion of the URL: i.e. i.stack.imgur.comi.sstatic.net

  • Any resize characters or query params on the image will remain intact and continue to work on the new domain.

What won't change

Instances of the word "Imgur" that are not part of a URL or don't otherwise look like an image link will not change. Additionally, image links across the network that load images from sites other than i.stack.imgur.com won’t change either.

Other information and errata

  1. As with our previous http → https conversion, we are not creating a new post revision, and we'll be updating historical values in post revision histories as well. This is because image URLs should continue to resolve to the same image whether or not i.stack.imgur.com is the site serving them. Therefore, there should be no issues covering edit rollbacks and revision comparisons. It also avoids making explicit edits that would otherwise bump a post, unlock a post’s upvotes and downvotes, and otherwise disrupt the site.

  2. Once the migration is complete, we’ll work with Imgur to redirect traffic to the appropriate images on our servers. But updating the actual data is the only guarantee we have complete control over how images resolve for the long term.

  3. Posts that happen to contain an i.stack.imgur.com URL but don't actually intend to link to that resource will also change as part of this update. For example, Code Golf exercises may change, and even this very meta post describing the link transition may change. These represent a small amount of cases across the network. However, as this process may alter important URLs, we ask that if you do notice an obvious error, kindly make or suggest an edit to fix it. Due to decision #1 above, there may not be a simple way for users to verify the previous state, so use your best judgment.

We will, of course, keep a database backup in case something has gone seriously wrong and needs significant intervention to fix.

Something's weird. What should I do?

If you notice anything odd, please feel free to leave a bug report here, or create a new meta post using the tag . While we will be reviewing every bug and feature request about our new image hosting service, our primary goal will be to quash serious issues, so that we can ensure the deployment goes smoothly and works as intended.

The rollout starts next week

Similar to the initial rollout of the new image service, we are planning a staged rollout for updates to image URLs, beginning early next week. We also have some special handling in place for sites like Stack Overflow to avoid any site interruptions due to the size of the affected tables, and we'll update this post when we start rolling changes out.

8
  • I don't understand point 3. Does it mean that when a post contains an URL to imgur, only a simple REPLACE(body, 'i.stack.imgur.com', 'i.sstatic.net') is done?
    – rene
    Commented May 7 at 15:20
  • 14
    @rene It's a hair more nuanced than a simple find-and-replace. A post qualifies for the URL update if it has a https://i.stack.imgur.com/<image ID>.<extension> URL anywhere within it. The image ID has to match the format of a "real" image ID, too. If the post contains any matching Imgur image URL in it, then yes, it's essentially a find-and-replace on //i.stack.imgur.com/ (slashes included). If the image ID looks "real" but doesn't actually point to an image, the post will still qualify for updating. Therefore, in some cases, a bare reference to i.stack.imgur.com might change.
    – Slate StaffMod
    Commented May 7 at 15:42
  • 3
    Okay, that sounds less bad then I imagined it. I expect we can deal with the few mishaps that occur due to how these replaces are done. Thanks for clarifying.
    – rene
    Commented May 7 at 16:14
  • 2
    Will support be added for .webp, animated .png or other formats?
    – Mentalist
    Commented May 8 at 2:18
  • 2
    @Mentalist meta.stackexchange.com/q/399497/997587
    – starball
    Commented May 8 at 2:21
  • IMHO to bad you didn't seize the opportunity to update the behaviour of the images posted. again and again its frustrating to see images that aren't clickable to easily navigate to them when the poster uploaded a huge image and the scaled down version is unreadable. and you have to "manually" open it in a seperate browser tab, to actually read the image. Commented May 15 at 10:39
  • @RandRandom Sounds like a great (but separate) feature request. The goal here seems to have been to maintain parity as closely as possible, and even that seems to have come at substantial effort. Not "let's also make all these changes at the same time" - particularly to content of existing posts. We could also appeal to users to not insist on posting ridiculously large images that have to be opened in a separate tab to be legible (and no chance on mobile without also zooming). Commented May 15 at 11:33
  • @RandRandom BTW I found this comment (and the one after it) interesting. The linking behavior does happen automatically for new image uploads, so I suspect your request is actually to go back and fix the markdown for images in the past that don't have a hyperlink? And I wonder if "manually" right-clicking is all that different from "manually" left-clicking anyway. :-) I think it's been argued in the past that the network certainly shouldn't force target=_blank. Commented May 15 at 12:22

7 Answers 7

17

There are many runnable javascript snippets that load images from imgur. Most of them (all?) load from i.imgur.com, not from i.stack.imgur.com because i.stack.imgur.com never had the correct CORS permissions to be useable by snippets

Examples:

Will this migration affect these snippets?

Further, will the new image hosting have the correct CORS permission so that images there can be used by snippets?

5
  • 4
    (concerning migration) ..why would it?
    – starball
    Commented May 8 at 5:44
  • 2
    The first and second example won't be changed as none of these posts contain https://​​i.stack.imgur.com/<image ID>.<extension> so those posts will not even be considered for the replace logic. In your last example both images and the code snippets will have the content changed from i.stack.imgur.com to i.sstatic.net is my expectation.
    – rene
    Commented May 8 at 15:32
  • 2
    @super-starball-ultra, people don't always explain things exactly as they are, they explain how they think they are. Maybe they should test this stuff won't break since it's close to what they claim to be changing. (1) the images in the examples are on imgur now. (2) S.O. is changing some imgur urls to non-imgur urls. (3) if the new server doesn't provide the same or compatible CORS permissions than any URLs changed in these samples will break them.
    – gman
    Commented May 9 at 4:10
  • 1
    It's still worth knowing what the CORS settings will be on the new domain, so that these (and future) images could be manually moved.
    – OrangeDog
    Commented May 15 at 9:15
  • 5
    @gman We just rolled out the CORS header and images can be used for StackSnippets.
    – Josh Zhang StaffMod
    Commented May 17 at 15:26
16

This seems to have broken Stack App images:

Application Icon must be hosted under Stack Exchange's Imgur account

enter image description here

1
  • 15
    Nice catch! We're tracking this internally already, I've got a fix ready and it's just going through my team's review.
    – Kyle Pollard StaffMod
    Commented May 9 at 18:30
14

Anyone that wants to have a network-wide list upfront of their own posts that contain links to the i.stack.imgur.com domain can use this cross-site query:

-- accountid: Accountid "Id of your network profile found on stackexchange.com"
-- includemainsites: Include Main Sites "(1 =yes, 0 = no)"
-- includemetasites: Include Meta Sites "(1 =yes, 0 = no)"
exec sede_ineachdb '
select -- top 10 
       [$site name$] [site name]
     , concat(
         [$site url$], ''/q/'', posts.id, ''|'', 
          coalesce(q.title, convert(nvarchar, posts.id))) [Link]
     , name [PostType]
     , substring(posts.body, patindex(''%http[s:]%/%stack.imgur.com/%'', posts.body), 100) [Part]
     , patindex(''%http[s:]%/%stack.imgur.com/%'', posts.body) [Position]
from posts
inner join posttypes on posttypes.id = posts.posttypeid
inner join users u on u.id = posts.owneruserid
left outer join posts q on q.id = coalesce(posts.parentid, posts.id)
where u.accountid = ##accountid##
and posts.body like ''%http[s:]%/%stack.imgur.com/%''
'
, ##includemainsites:int?1##
, ##includemetasites:int?0##

You'll need your AccountId which you can find by clicking on Network Profile in your User Profile. The AccountId is the number after https://stackexchange.com/users/{accountid}/name.

When you run the query you select posts for either main sites only or meta sites only. That might be needed if you are a prolific user that posted a ton across all sites. So if you're a power user and run into timeouts you have to use the on site Stack Exchange search, sorry.

The result of the query will look like this:

table with sitename, link to post, posttype, part of body, position in body text

Keep in mind SEDE is updated once a week on Sunday.
Use the great SEDE Tutorial written by the wonderful Monica Cellio.
Say "Hi" in SEDE chat.

2
  • I recommend you change the search so it includes URLs starting //.
    – msh210
    Commented May 13 at 6:13
  • There are several non-precise ways to select those URLs, and your suggestion is one I would have considered my self. However I have had a little insight information and that where clause matches closer to what will be used in the SQL script, at least at the time I wrote the answer.
    – rene
    Commented May 13 at 7:31
11
  1. What is the size limitation for new images uploaded to the new system?

  2. Will the help manual or FAQ be updated to have an entry on how to upload a picture?

  3. Will there be cross linking in the help so if you search for picture or image or photo you are directed to the relevant help?

  4. What image formats will be supported?

6
  • 15
    The new system is broadly identical to the new one Commented May 7 at 23:43
  • 2
    Isn't this all covered in: meta.stackexchange.com/questions/395024/…
    – rene
    Commented May 8 at 5:53
  • 30
    @JourneymanGeek "The new system is broadly identical to the new one" - well put xD
    – Kromster
    Commented May 8 at 7:29
  • .... I mean the old system is broadly similar to the new one, and vice versa Commented May 8 at 10:55
  • 1
    @rene Actually none of these questions are addressed by that post
    – kevinskio
    Commented May 8 at 15:00
  • 5
    Maybe not addressed but some of your points are raised in answers on that question. And I think all points you raised are better handled there, as this question is only meant to inform us about changing the URLs in the posts to the new image hosting service.
    – rene
    Commented May 8 at 15:14
6

The image resize characters do not work the same way on the new hosting as they did on imgur. Resizing the images only takes the width into account, not the height. This causes problems for extremely tall images.

To demonstrate, a 200x700 image uploaded to both imgur and the new hosting service, also rotated to a 700x200 image. All four uses have the "m" resize character at the end, which limits the width to 320px.

imgur on the left, SO on the right.

Wide:

Wide image on imgur Wide image on SO

Tall:

Tall image on imgur enter image description here

1
  • 3
    Thanks for letting us know, we'll do some investigating on our end.
    – tanj92 Staff
    Commented May 15 at 15:37
4

The last few weeks or so, I have experienced issues viewing images on Stack Exchange sites.

Often, I don't see images at all. I only see links with the alternate texts (often the default "Enter image description here"). If I follow such as link, I am met with something like this:

"oh no, that request didn't look right
RayID: 88423cb16e5409af"

For example, I cannot see any images in this post.

Here's how it looks for me:

Screenshot of Stack Overflow post with broken images.

(Ironically, I cannot see this screenshot I just uploaded (?) either.)

If I click on the first link in this Q, I am met with

Screenshot of error message

(and I cannot see this newly uploaded screenshot myself either!).

What is causing this?

14
  • Are you using TOR? Commented May 15 at 10:03
  • I don't know what "TOR" is, so I don't think I am using it. I might add that I only have encountered this issue at my work PC; I don't think I have ever seen it at home. Commented May 15 at 10:03
  • not sure what you replied to, but what I meant is to ask if you browse the internet using this. Since you appear to not know what it is, guess the answer is "no", so would have to think of other possible causes. Commented May 15 at 10:04
  • Suddenly, I can now see the two screenshots in this post of mine. But I can still not see the ones in the linked StackOverflow Q. Commented May 15 at 10:10
  • Can you check the console from the developer tools in the browser, is there any error there? Commented May 15 at 10:32
  • @AbdulAzizBarkat: The PNGs from i.sstatic.net fail. One example (translated to English from Swedish by me right now): Status = Failed, Method = GET, Domain = i.sstatic.net, File = A2zc7PC8.png, Initializer = img, Type = html, Transferred = NS_ERROR_FAILURE, Size = 0 B, Status = 400, Version = HTTP/2, Referrer policy = strict-origin-when-cross-origin and many, many more fields Commented May 15 at 10:44
  • Your ISP or work network might "obscure" traffic in some way, making the CDN think the request isn't coming from SO, hence blocking it. Commented May 15 at 11:18
  • One easy way to check is the Referer header, in the developer tools, go to Network tab, reload, and check the Request Headers of one of the images that doesn't load. Scroll down, and you should see Referer header, e.g. that's what I see. Do you have blank value there? If you can't see the screenshot, uploaded to imgur as well. :) Commented May 15 at 11:25
  • @ShadowWizardLoveZelda: I cannot see your image, but my Referer is set to "stackoverflow.com" for one of the problematic PNGs embedded in the linked Q. [Update: Yes, I can see your imgur image, and my referrer is the same.] Commented May 15 at 11:27
  • Ah dang, here goes another direction. Sorry but looks like we'll have to wait for a developer to take a look, and it might.... take a while. Commented May 15 at 11:28
  • @ShadowWizardLoveZelda: No problem. I should mention that I'm using Firefox on Windows 11. Commented May 15 at 11:29
  • Doubt it's related to browser, it's something on your side, but question is why and what triggers the block. Commented May 15 at 12:44
  • 1
    Sounds similar to this bug: meta.stackexchange.com/questions/399031/… which is marked no-repro ...
    – rene
    Commented May 15 at 13:00
  • I'm not sure if it is related, but recently I also experience another issue: Often code blocks (and also inline code spans) appear empty or with "garbage". Commented Jun 12 at 8:50
1

About two days ago I was looking at this old CodeGolf post, which (used to have) some great images on it.

I noticed that the Python code in the post had had a lot of array indices changed: a line that was clearly supposed to say a[1] had become a[6] the first time it was referenced, then a[7] on the next reference, and so on.

So I edited the post to fix those array indices. And when I reloaded the page, I saw that somehow this had broken all the images in the post and I don't see any image URLs anywhere in the post, so I don't know how to recover those images! It just shows fake image names like

![Mona Lisa 0.01 tolerance][1]
![Mandrill 0.01 tolerance][2]

I don't know if this data loss was related to the recent image migration, or some vastly older migration. (The post itself is from 2014!) But I really hope someone can help get those awesome images back. And/or, maybe save some other old posts' images before they're gone.

Thanks for any help!

4
  • 2
    Code Golf hasn't been migrated to i.sstatic.net yet, so it seems to be unrelated to this migration. I would suggest asking on Code Golf Meta. Rest assured, though - the image URLs are safe in the revision history of the post.
    – Slate StaffMod
    Commented May 21 at 13:44
  • 2
    Looking at the source it is just missing newlines before the image markdown. That post was posted on 2014 and I believe the renderer is changed a bit after that. Just edit again to add in the required newlines. Commented May 21 at 13:46
  • @Slate — thanks; can you please apply the edit suggested by AbdulAzizBarkat, then, to add newlines so that the images come back? I would do it myself but I'm still confused about what you mean "the image URLs are safe in the revision history of the post." I don't see any URLs here or here. Is there an "invisible history" too, from which you (as a mod) could recover those URLs? Commented May 22 at 15:06
  • Okay, this was indeed unrelated to migration. The Markdown parser (had I guess changed in the last 10 years and thus, now,) didn't like the explicit <p> tags OP used to separate their paragraphs. Changing those <p>s to blank lines makes the images come back. I'm still not sure why the page history hides the URLs, but it's all good now! Feel free to downvote, delete, whatever, at this point. :) Commented May 23 at 16:02

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .