{"id":24699,"date":"2013-08-12T21:43:18","date_gmt":"2013-08-12T21:43:18","guid":{"rendered":"https:\/\/wordpress.org\/plugins-wp\/media-placeholders\/"},"modified":"2015-02-25T01:45:54","modified_gmt":"2015-02-25T01:45:54","slug":"media-placeholders","status":"publish","type":"plugin","link":"https:\/\/ceb.wordpress.org\/plugins\/media-placeholders\/","author":186678,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_crdt_document":"","version":"0.9.2","stable_tag":"trunk","tested":"3.6.1","requires":"3.5","requires_php":"","requires_plugins":"","header_name":"Media Placeholders","header_author":"X-Team","header_description":"","assets_banners_color":"696969","last_updated":"2015-02-25 01:45:54","external_support_url":"","external_repository_url":"","donate_link":"","header_plugin_uri":"http:\/\/github.com\/x-team\/wp-missing-upload-placeholders","header_author_uri":"http:\/\/x-team.com\/wordpress\/","rating":5,"author_block_rating":0,"active_installs":70,"downloads":3369,"num_ratings":2,"support_threads":0,"support_threads_resolved":0,"author_block_count":0,"sections":["description","changelog"],"tags":[],"upgrade_notice":[],"ratings":{"1":0,"2":0,"3":0,"4":0,"5":"2"},"assets_icons":[],"assets_banners":{"banner-1544x500.png":{"filename":"banner-1544x500.png","revision":"755312","resolution":"1544x500","location":"assets"},"banner-772x250.png":{"filename":"banner-772x250.png","revision":"755312","resolution":"772x250","location":"assets"}},"assets_blueprints":{},"all_blocks":[],"tagged_versions":[],"block_files":[],"assets_screenshots":[],"screenshots":[],"jetpack_post_was_ever_published":false},"plugin_section":[],"plugin_tags":[905,734,163,33558,85],"plugin_category":[50],"plugin_contributors":[78438,78325],"plugin_business_model":[],"class_list":["post-24699","plugin","type-plugin","status-publish","hentry","plugin_tags-905","plugin_tags-development","plugin_tags-images","plugin_tags-placeholders","plugin_tags-uploads","plugin_category-media","plugin_contributors-westonruter","plugin_contributors-xwp","plugin_committers-westonruter"],"banners":{"banner":"https:\/\/ps.w.org\/media-placeholders\/assets\/banner-772x250.png?rev=755312","banner_2x":"https:\/\/ps.w.org\/media-placeholders\/assets\/banner-1544x500.png?rev=755312","banner_rtl":false,"banner_2x_rtl":false},"icons":{"svg":false,"icon":"https:\/\/s.w.org\/plugins\/geopattern-icon\/media-placeholders_696969.svg","icon_2x":false,"generated":true},"screenshots":[],"raw_content":"<!--section=description-->\n<p>Activate this plugin to redirect all requests for missing uploaded images on your blog to your favorite placeholder image service, such as <a href=\"http:\/\/placehold.it\">placehold.it<\/a> or <a href=\"http:\/\/placekitten.com\/\">placekitten.com<\/a>. 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 <code>MISSING_UPLOADED_IMAGE_PLACEHOLDER_BUILTIN<\/code> to be <code>placekitten_color<\/code> or <code>placekitten_grayscale<\/code>, or supplying those same values via the <code>missing_uploaded_image_placeholder_builtin<\/code> filter).<\/p>\n\n<p><strong>This plugin is for use during development only.<\/strong> 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 <a href=\"http:\/\/wordpress.org\/plugins\/uploads-by-proxy\/\">Uploads by Proxy<\/a> plugin.<\/p>\n\n<p>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 <code>MISSING_UPLOADED_IMAGE_REDIRECT_SERVER<\/code> constant or filter <code>missing_uploaded_image_redirect_server<\/code> to short-circuit the placeholder service and redirect the image request to that server.<\/p>\n\n<p>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 <code>\/files\/<\/code> which is intercepted by a rewrite rule and passed directly to <code>ms-files.php<\/code>. See <a href=\"http:\/\/core.trac.wordpress.org\/ticket\/19235\" title=\"Turn ms-files.php off by default\">#19235<\/a>. 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 <code>png|jpg|jpeg|gif<\/code> from the following location rule in <code>nginx-wp-common.conf<\/code> (or remove it altogether):<\/p>\n\n<pre><code># Handle all static assets by serving the file directly. Add directives \n# to send expires headers and turn off 404 error logging.\nlocation ~* \\.(js|css|png|jpg|jpeg|gif|ico)$ {\n    expires 24h;\n    log_not_found off;\n}\n<\/code><\/pre>\n\n<p>You can add support for your own favorite placeholder services by filtering <code>missing_uploaded_image_placeholder<\/code>.\nFor example, you can add this to your <code>functions.php<\/code> or drop it into a <code>mu-plugin<\/code>:<\/p>\n\n<pre><code>&lt;?php\n\/**\n * Use Flickholdr as placeholder service\n * @param null|string $url\n * @param array $args  {attached_file, width, height, attachment_id}\n *\/\nfunction my_filter_missing_uploaded_image_placeholder( $url, $args ) {\n    $attachment = get_post( $args['attachment_id'] );\n    $tags = join( ' ', array(\n        $attachment-&gt;post_title,\n        $attachment-&gt;post_excerpt,\n        $attachment-&gt;post_content,\n        $attachment-&gt;_wp_attachment_image_alt\n    ) );\n    $tags = strtolower( preg_replace( '#[^A-Za-z0-9]+#', ',', $tags ) );\n    $tags = trim( $tags, ',' );\n    $url = sprintf( 'http:\/\/flickholdr.com\/%d\/%d\/%s', $args['width'], $args['height'], $tags );\n    return $url;\n}\nadd_filter( 'missing_uploaded_image_placeholder', 'my_filter_missing_uploaded_image_placeholder', 10, 2 );\n<\/code><\/pre>\n\n<p><strong>Development of this plugin is done <a href=\"https:\/\/github.com\/x-team\/wp-media-placeholders\">on GitHub<\/a>. Pull requests welcome. Please see <a href=\"https:\/\/github.com\/x-team\/wp-media-placeholders\/issues\">issues<\/a> reported there before going to the plugin forum.<\/strong><\/p>\n\n<!--section=changelog-->\n<h4>0.9.2<\/h4>\n\n<p>Apply PHPCS fixes and integrate Travis CI<\/p>\n\n<h4>0.9.1<\/h4>\n\n<p>Prevent default WordPress 404 handler from breaking placeholder redirect (<a href=\"https:\/\/github.com\/x-team\/wp-media-placeholders\/pull\/5\">#5<\/a>)<\/p>\n\n<h4>0.9<\/h4>\n\n<p>First Release<\/p>","raw_excerpt":"Redirect requests to non-existent uploaded images to a placeholder service like placehold.it or placekitten.com. For use during development.","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/ceb.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin\/24699","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ceb.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin"}],"about":[{"href":"https:\/\/ceb.wordpress.org\/plugins\/wp-json\/wp\/v2\/types\/plugin"}],"replies":[{"embeddable":true,"href":"https:\/\/ceb.wordpress.org\/plugins\/wp-json\/wp\/v2\/comments?post=24699"}],"author":[{"embeddable":true,"href":"https:\/\/ceb.wordpress.org\/plugins\/wp-json\/wporg\/v1\/users\/westonruter"}],"wp:attachment":[{"href":"https:\/\/ceb.wordpress.org\/plugins\/wp-json\/wp\/v2\/media?parent=24699"}],"wp:term":[{"taxonomy":"plugin_section","embeddable":true,"href":"https:\/\/ceb.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_section?post=24699"},{"taxonomy":"plugin_tags","embeddable":true,"href":"https:\/\/ceb.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_tags?post=24699"},{"taxonomy":"plugin_category","embeddable":true,"href":"https:\/\/ceb.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_category?post=24699"},{"taxonomy":"plugin_contributors","embeddable":true,"href":"https:\/\/ceb.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_contributors?post=24699"},{"taxonomy":"plugin_business_model","embeddable":true,"href":"https:\/\/ceb.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_business_model?post=24699"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}