Title: Media Placeholders
Author: Weston Ruter
Published: <strong>12. august, 2013</strong>
Last modified: 25. februar, 2015

---

Søg plugins

![](https://ps.w.org/media-placeholders/assets/banner-772x250.png?rev=755312)

Dette plugin **er ikke blevet testet med de seneste 3 større udgivelser af WordPress**.
Det vedligeholdes eller understøttes muligvis ikke længere og kan have kompatibilitetsproblemer,
når det bruges med nyere versioner af WordPress.

![](https://s.w.org/plugins/geopattern-icon/media-placeholders_696969.svg)

# Media Placeholders

 Af [Weston Ruter](https://profiles.wordpress.org/westonruter/)

[Download](https://downloads.wordpress.org/plugin/media-placeholders.zip)

 * [Detaljer](https://da.wordpress.org/plugins/media-placeholders/#description)
 * [Vurderinger](https://da.wordpress.org/plugins/media-placeholders/#reviews)
 * [Udvikling](https://da.wordpress.org/plugins/media-placeholders/#developers)

 [Support](https://wordpress.org/support/plugin/media-placeholders/)

## Beskrivelse

Activate this plugin to redirect all requests for missing uploaded images on your
blog to your favorite placeholder image service, such as [placehold.it](http://placehold.it)
or [placekitten.com](http://placekitten.com/). Note that although kittens are cute,
the placehold.it service is actually more useful because the background and foreground
color can remain consistant across all image sizes (e.g. full size vs thumbnail 
in a gallery), and so it is easier to see which images in a page are related to 
each other. (You can change the default placehold.it service to placekitten.com 
by defining `MISSING_UPLOADED_IMAGE_PLACEHOLDER_BUILTIN` to be `placekitten_color`
or `placekitten_grayscale`, or supplying those same values via the `missing_uploaded_image_placeholder_builtin`
filter).

**This plugin is for use during development only.** It is expected that this plugin
will be activated on your local development environment (e.g. on Vagrant or XAMPP),
or on your staging server. This plugin is especially useful when working on a team
where you share around a database dump but not the uploaded images (which should
always be omitted from the code repository), so if you give a database dump to another
developer but don’t include the uploaded images, with this plugin enabled they will
see a placeholder where the uploaded image appears. This plugin is an alternative
approach to what is offered by the [Uploads by Proxy](https://wordpress.org/plugins/uploads-by-proxy/)
plugin.

If you have applied the production database to another environment which lacks the
uploaded files, but you know that all images referenced in the database do exist
on production, you can define the `MISSING_UPLOADED_IMAGE_REDIRECT_SERVER` constant
or filter `missing_uploaded_image_redirect_server` to short-circuit the placeholder
service and redirect the image request to that server.

This plugin will not work if you are on a multisite network that uses the old system
for referring to uploaded files, where the URL includes `/files/` which is intercepted
by a rewrite rule and passed directly to `ms-files.php`. See [#19235](https://core.trac.wordpress.org/ticket/19235).
Similarly, make sure that missing uploaded files get served by the WordPress 404
handler, not Apache/Nginx. If you are using Nginx with the default Varying Vagrant
Vagrants config, you’ll want to remove `png|jpg|jpeg|gif` from the following location
rule in `nginx-wp-common.conf` (or remove it altogether):

    ```
    # Handle all static assets by serving the file directly. Add directives 
    # to send expires headers and turn off 404 error logging.
    location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
        expires 24h;
        log_not_found off;
    }
    ```

You can add support for your own favorite placeholder services by filtering `missing_uploaded_image_placeholder`.

For example, you can add this to your `functions.php` or drop it into a `mu-plugin`:

    ```
    <?php
    /**
     * Use Flickholdr as placeholder service
     * @param null|string $url
     * @param array $args  {attached_file, width, height, attachment_id}
     */
    function my_filter_missing_uploaded_image_placeholder( $url, $args ) {
        $attachment = get_post( $args['attachment_id'] );
        $tags = join( ' ', array(
            $attachment->post_title,
            $attachment->post_excerpt,
            $attachment->post_content,
            $attachment->_wp_attachment_image_alt
        ) );
        $tags = strtolower( preg_replace( '#[^A-Za-z0-9]+#', ',', $tags ) );
        $tags = trim( $tags, ',' );
        $url = sprintf( 'http://flickholdr.com/%d/%d/%s', $args['width'], $args['height'], $tags );
        return $url;
    }
    add_filter( 'missing_uploaded_image_placeholder', 'my_filter_missing_uploaded_image_placeholder', 10, 2 );
    ```

**Development of this plugin is done [on GitHub](https://github.com/x-team/wp-media-placeholders).
Pull requests welcome. Please see [issues](https://github.com/x-team/wp-media-placeholders/issues)
reported there before going to the plugin forum.**

## Anmeldelser

![](https://secure.gravatar.com/avatar/ad4c663dfec95b9a11e9e6384e8440f339d0064892ae0df8df1301932e7d8ac1?
s=60&d=retro&r=g)

### 󠀁[Cool 😉](https://wordpress.org/support/topic/cool-1-2/)󠁿

 [holgerhubbs](https://profiles.wordpress.org/holgerhubbs/) 3. september, 2016

Thank you!

 [ Læs alle 2 anmeldelser ](https://wordpress.org/support/plugin/media-placeholders/reviews/)

## Bidragsydere & udviklere

“Media Placeholders” er open source-software. Følgende personer har bidraget til
dette plugin.

Bidragsydere

 *   [ Weston Ruter ](https://profiles.wordpress.org/westonruter/)
 *   [ XWP ](https://profiles.wordpress.org/xwp/)

[Oversæt “Media Placeholders” til dit eget sprog.](https://translate.wordpress.org/projects/wp-plugins/media-placeholders)

### Interesseret i udvikling?

[Gennemse koden](https://plugins.trac.wordpress.org/browser/media-placeholders/),
tjek [SVN repository](https://plugins.svn.wordpress.org/media-placeholders/), eller
abonner på [udviklerloggen](https://plugins.trac.wordpress.org/log/media-placeholders/)
via [RSS](https://plugins.trac.wordpress.org/log/media-placeholders/?limit=100&mode=stop_on_copy&format=rss).

## Ændringslog

#### 0.9.2

Apply PHPCS fixes and integrate Travis CI

#### 0.9.1

Prevent default WordPress 404 handler from breaking placeholder redirect ([#5](https://github.com/x-team/wp-media-placeholders/pull/5))

#### 0.9

First Release

## Meta

 *  Version **0.9.2**
 *  Senest opdateret **12 år siden**
 *  Aktive installationer **60+**
 *  WordPress-version ** 3.5 eller højere **
 *  Testet op til **3.6.1**
 *  Sprog
 * [English (US)](https://wordpress.org/plugins/media-placeholders/)
 * Tags
 * [404](https://da.wordpress.org/plugins/tags/404/)[development](https://da.wordpress.org/plugins/tags/development/)
   [images](https://da.wordpress.org/plugins/tags/images/)[placeholders](https://da.wordpress.org/plugins/tags/placeholders/)
   [uploads](https://da.wordpress.org/plugins/tags/uploads/)
 *  [Avanceret visning](https://da.wordpress.org/plugins/media-placeholders/advanced/)

## Bedømmelser

 5 ud af 5 stjerner.

 *  [  2 5-stjernet anmeldelser     ](https://wordpress.org/support/plugin/media-placeholders/reviews/?filter=5)
 *  [  0 4-stjernet anmeldelser     ](https://wordpress.org/support/plugin/media-placeholders/reviews/?filter=4)
 *  [  0 3-stjernet anmeldelser     ](https://wordpress.org/support/plugin/media-placeholders/reviews/?filter=3)
 *  [  0 2-stjernet anmeldelser     ](https://wordpress.org/support/plugin/media-placeholders/reviews/?filter=2)
 *  [  0 1-stjernet anmeldelser     ](https://wordpress.org/support/plugin/media-placeholders/reviews/?filter=1)

[Din anmeldelse](https://wordpress.org/support/plugin/media-placeholders/reviews/#new-post)

[Se alle anmeldelser](https://wordpress.org/support/plugin/media-placeholders/reviews/)

## Bidragsydere

 *   [ Weston Ruter ](https://profiles.wordpress.org/westonruter/)
 *   [ XWP ](https://profiles.wordpress.org/xwp/)

## Support

Har du noget at sige? Har du brug for hjælp?

 [Vis supportforum](https://wordpress.org/support/plugin/media-placeholders/)