# 欠落している画像をどのように見つけるか？

**URL:** https://meta.discourse.org/t/how-to-find-any-missing-images/115672
**Category:** Support
**Created:** [2019 年 4 月 23 日午前 3:52 UTC](https://meta.discourse.org/t/how-to-find-any-missing-images/115672 "2019-04-23T03:52:14Z")
**Posts on this page:** 1
**Showing post:** 21

<div class="post-metadata">

### Author: ![kansaichris](https://avatars.discourse-cdn.com/v4/letter/k/ccd318/32.png) [@kansaichris](https://meta.discourse.org/u/kansaichris)
#### Post date: [2019 年 5 月 17 日午前 6:02 UTC](https://meta.discourse.org/t/how-to-find-any-missing-images/115672/21 "2019-05-17T06:02:29Z")

</div>

Thanks for continuing to work on this, @vinothkannans! ✨

I just tried running the `rake posts:missing_uploads` task on my site (currently at [v2.3.0.beta9 +484](https://github.com/discourse/discourse/compare/1ab0f0ccb4ba8a2feefb2f1c7076080e79e4c162...beta)), and this is what I got:

```plaintext
# rake posts:missing_uploads
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.xxxxxx.xxxxxxxx.xxxxxxxxxx..........................x...........................................x.......................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................x.................................................................................................................................................................................................................
451 post uploads are missing.

255 uploads are missing.
244 of 255 are old scheme uploads.
139 of 8812 posts are affected.

```

In other words, it looks like I have:

- **244** missing old scheme uploads
- **11** missing uploads
- **196** missing post uploads

Just as an aside…what’s the difference between a missing _upload_ and a missing _post upload?_ (If I’m reading the output correctly, I have _196 more_ of the latter.)

Anyway, because I appear to have _a lot_ of missing images, I decided to do a bit more spelunking with `PostCustomField.where(name: Post::MISSING_UPLOADS)`. Consider the first result:

```plaintext
#<PostCustomField:0x0000564c2cef9ee8
  id: 161,
  post_id: 43,
  name: "missing uploads",
  value:
   "[\"https://SITENAME/uploads/default/35/4608d96d1b27846f.png\",\"https://SITENAME/uploads/default/35/4608d96d1b27846f.png\"]",
  created_at: Fri, 17 May 2019 05:26:57 UTC +00:00,
  updated_at: Fri, 17 May 2019 05:26:57 UTC +00:00>

```

I navigated to `https://SITENAME/p/43` and, sure enough, upon examining the post’s Markdown source I found a link to an image at `/uploads/default/35/4608d96d1b27846f.png`. Interestingly enough, though, the image displays fine and even exists at `/var/discourse/shared/standalone/uploads/default/35/4608d96d1b27846f.png` on the host server.

So…Discourse appears to think that this image is “missing”, but it’s not—it just hasn’t been migrated to the new upload scheme yet. Is this expected behavior and, if so, is there any way to migrate the other (200+) images like this to the new upload scheme?

Thanks!

* * *

**Update:** I think I may have identified the 11 missing uploads mentioned above…and they really do seem to be missing. Here’s what one of them looks like:

```plaintext
#<PostCustomField:0x0000564c2cf0b2d8
  id: 297,
  post_id: 2203,
  name: "missing uploads",
  value:
   "[\"https://SITENAME/uploads/default/original/1X/900eff3dd456ecaf5280568676c4717e27b46c85.jpg\"]",
  created_at: Fri, 17 May 2019 05:26:57 UTC +00:00,
  updated_at: Fri, 17 May 2019 05:26:57 UTC +00:00>

```

Note that this particular image was stored under `/uploads/default/original/1X/` rather than `/uploads/default/{SOME_NUMBER}/`. It’s from a 2015 post and I can’t find it in any of my backups, so it—and the other 10 images like it—appear to be well and truly gone. 😢

Still not sure why I have 196 more missing _post uploads_ than _uploads_, though…

---

_[View the full topic](https://meta.discourse.org/t/how-to-find-any-missing-images/115672)._
