# Uploads/Media Best Practice

**URL:** https://discourse.roots.io/t/uploads-media-best-practice/9992
**Category:** bedrock
**Tags:** deploys
**Created:** 2017-07-14T15:31:49Z
**Posts:** 19

## Post 1 by @d-a-v-e — 2017-07-14T15:31:49Z

I’ve looked and searched here for any best practice for handling and serving media/uploads/images; staying organised and in sync.

I’m using a digital ocean setup and have the uploads content served directly from there.

Ultimately I know media/content should be uploaded to the live site, with copies pulled into development when its necessary to do so. But initial setups/builds always take place locally until theres something worth pushing live/staging.

I use wp-db-sync to keep the database up-to-date in either direction and this works wonderfully.

For uploading/downloading images `scp` is used.

Is this whats most common or do people make use of CDNs s3 or some other cloud solution?

Any pointers or suggestions welcome, apologies if my question is not direct enough.

---

## Post 2 by @craigpearson — 2017-07-15T17:53:12Z

I personally find [this playbook](https://gist.github.com/louim/b16091082746dc920f20) handy by @louim. It uses rsync which is a lot more efficient than scp. It only copies media when it’s needed.

Of course having a CDN would be ideal, but in some projects the budget/time doesn’t allow for it

Here’s the full post: [Pushing or pulling uploads with Trellis](https://discourse.roots.io/t/pushing-or-pulling-uploads-with-trellis/4177)

---

## Post 3 by @Simeon — 2017-07-16T11:31:32Z

> [@d-a-v-e](#):
>
> wp-db-sync

This is a free plugin but the premium version it’s ripping off has a Media Files add-on. It’ll do a media transfer while syncing the DB.

> **[WP Migrate - Push/Pull Your WordPress Database & Files](https://deliciousbrains.com/wp-migrate-db-pro/)**
>
> Find out how WP Migrate can save you hours with 1-click migration for your database, media, themes & plugins. Watch a full demo to see how it works.

---

## Post 4 by @d-a-v-e — 2017-07-17T10:16:59Z

Thanks @Simeon the ‘legit’ version is on my radar and I may well fork out in the future once the number of wp sites maintained/built justifies it.

---

## Post 5 by @Jon — 2017-07-21T09:33:15Z

For us, the best practice is not keeping uploads on the Wordpress instance at all. Everything goes to S3. Images are served through Imgix, which performs all the image operations such as scaling and cropping on the fly.

I wrote a plugin to manage all of this:

> **[Media Cloud](https://wordpress.org/plugins/ilab-media-tools/)**
>
> Automatically upload media to Amazon S3 and integrate with Imgix, a real-time image processing CDN. Boosts site performance and simplifies workflows.

You can use via composer `ilab/ilab-media-tools`

---

## Post 6 by @d-a-v-e — 2017-07-25T21:57:32Z

Thanks for linking this, looks like a fantastic solution. Will be using this in the next build :grinning:

---

## Post 7 by @thewhipster — 2017-09-06T01:30:00Z

Hi @Jon. Gave your plugin a whirl as it solves a key need here. added via composer and went to activate to find it won’t with a fatal error below. On php7, sage9.  
atal error: Cannot redeclare render\_view() (previously declared in /srv/www/[domain].com/current/web/app/plugins/wp-views/embedded/inc/wpv-api.php:147) in /srv/www/[domain].com/current/web/app/plugins/ilab-media-tools/helpers/ilab-media-tool-view.php on line 77  
Call Stack

# Time Memory Function Location

1 0.0010 473968 {main}( ) …/plugins.php:0  
2 1.8409 57162512 plugin\_sandbox\_scrape( ) …/plugins.php:164  
3 1.8416 57176136 include( ‘/srv/www/[domain].com/current/web/app/plugins/ilab-media-tools/ilab-media-tools.php’ ) …/plugin.php:1882

---

## Post 8 by @kalenjohnson — 2017-09-06T05:24:54Z

You have two plugins with the same function name. They should either be prefixing their function name with a unique prefix or using PHP namespaces. You should probably let both of them know their plugin code is causing fatal errors.

---

## Post 9 by @Michael — 2017-09-06T15:57:31Z

Thanks for the plugin Jon! I’ll be giving it a try.

---

## Post 10 by @Jon — 2017-09-06T16:10:11Z

That’s what you get for using Types :wink:

---

## Post 11 by @Jon — 2017-09-06T16:45:10Z

I just posted 1.4.7 which fixes the issue.

Thanks!

---

## Post 12 by @thewhipster — 2017-09-07T14:45:32Z

Thanks man! I see all y’all ACF fan-boys :slight_smile:

---

## Post 13 by @strarsis — 2017-09-07T15:42:29Z

> [@How to manage image URLs through development to staging to production](https://discourse.roots.io/t/how-to-manage-image-urls-through-development-to-staging-to-production/9423/2):
>
> There is a nice tool for this which also replaces the URLs automatically - the way how it does is also recommended by WordPress Codex. Tool discussion: Codex page (mentions database search+replace): [https://codex.wordpress.org/Changing\_The\_Site\_URL](https://codex.wordpress.org/Changing_The_Site_URL) WP CLI (used by the tool mentioned above): [http://wp-cli.org/commands/search-replace/](http://wp-cli.org/commands/search-replace/)

---

## Post 14 by @thewhipster — 2017-11-05T04:32:44Z

Great plugin @Jon . I’m slowly stripping out Types for ACF and dropped S3 Offload in favor of Media Cloud with imgix. Top notch work.

---

## Post 15 by @Jon — 2018-12-12T22:47:34Z

Good catch, will look into it.

Thanks.

---

## Post 16 by @Jon — 2018-12-12T22:48:35Z

Hah lol that was from a year ago. Nevermind :wink:

---

## Post 17 by @austin — 2018-12-20T02:11:15Z

We use [https://github.com/humanmade/S3-Uploads](https://github.com/humanmade/S3-Uploads) and it works just fine at scale. Pulling things down to dev is a non-issue because all the correct URLs are in the database.

---

## Post 18 by @richt — 2019-10-04T12:04:52Z

I’ve just started using this plugin, all installed great.

I’m a bit stumped on the correct image upload path from Bedrock as described in the plugin documentation here:

`wp s3-uploads upload-directory /path/to/uploads/ uploads`

What’s the correct path in place of `/path/to/uploads` ?

---

## Post 19 by @Doocey — 2019-10-04T14:47:23Z

I can’t remember 100%, but I’m pretty sure it’s relative to where you run the wp command from.  
Try navigating to your install and under _current_ - swap the above path for: **/web/app/uploads**

If that doesn’t work, keep testing it out with different variations. I’m pretty sure /web/app/uploads/ worked for me, when I ran said command from inside the _current_ directory.
