# Download Remote Images with Referer (plugin possible?)

**URL:** <https://meta.discourse.org/t/download-remote-images-with-referer-plugin-possible/260027>\
**Category:** Development\
**Created:** [March 30, 2023, 10:08pm UTC](https://meta.discourse.org/t/download-remote-images-with-referer-plugin-possible/260027 "2023-03-30T22:08:53Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![shyguy](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/shyguy/32/295079_2.png) [@shyguy](https://meta.discourse.org/u/shyguy)\
**Post date:** [March 30, 2023, 10:08pm UTC](https://meta.discourse.org/t/download-remote-images-with-referer-plugin-possible/260027/1 "2023-03-30T22:08:54Z")

</div>

i’m working on a migration to discourse, and i know about `SiteSetting.download_remote_images_to_local`. it’s awesome.

however, when i (slow) rebake to download them all, i’m noticing that **Photobucket** serves a watermarked image depending on your referer.

i looked briefly, and it looks like downloading is handled in `/lib/final_destination.rb`. i could probably patch that temporarily just for the post-migration rebake, but that doesn’t handle the hypothetical situation of people hotlinking images from crappy image hosts going forward. i think any sane person knows better than to use Photobucket now, and idk of others that watermark, so maybe not a big deal.

my question is this.. has anyone already solved this? and **is this something a plugin could accomplish**? i have not learned about how plugins work yet.

alternatively, **would it be a bad feature suggestion to just always set the referrer to `scheme://domain/` when downloading a remote image?** when would that ever be a bad thing to have discourse itself do it?

if you want to see what i’m talking about:

`https://i1111.photobucket.com/albums/h475/scoobystuff/Stereo/S1080033.jpg`

```bash
# watermark:
curl -LO \
  'https://i1111.photobucket.com/albums/h475/scoobystuff/Stereo/S1080033.jpg'
# no watermark:
curl -LO --referer 'https://i1111.photobucket.com/' \
  'https://i1111.photobucket.com/albums/h475/scoobystuff/Stereo/S1080033.jpg'

```

 ![](https://global.discourse-cdn.com/meta/original/4X/8/a/e/8ae4bc3e6a661705430ba1303b7ed26170f7ca84.jpeg)

---

_[View the full topic](https://meta.discourse.org/t/download-remote-images-with-referer-plugin-possible/260027)._
