Mechanical rename of base::debug -> base::trace_event [final pass]
[chromium-blink-merge.git] / third_party / polymer / components-chromium / core-image / core-image.html
blobc2da9ad93bac7d09da70c604274582f3cb61ee24
1 <!--
2 Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
3 This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
4 The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
5 The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
6 Code distributed by Google as part of the polymer project is also
7 subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
8 --><!--
9 `core-image` is an element for displaying an image that provides useful sizing and
10 preloading options not found on the standard `<img>` tag.
12 The `sizing` option allows the image to be either cropped (`cover`) or
13 letterboxed (`contain`) to fill a fixed user-size placed on the element.
15 The `preload` option prevents the browser from rendering the image until the
16 image is fully loaded. In the interim, either the element's CSS `background-color`
17 can be be used as the placeholder, or the `placeholder` property can be
18 set to a URL (preferably a data-URI, for instant rendering) for an
19 placeholder image.
21 The `fade` option (only valid when `preload` is set) will cause the placeholder
22 image/color to be faded out once the image is rendered.
24 Examples:
26 Basically identical to &lt;img src="..."&gt; tag:
28 <core-image src="http://lorempixel.com/400/400"></core-image>
30 Will letterbox the image to fit:
32 <core-image style="width:400px; height:400px;" sizing="contain"
33 src="http://lorempixel.com/600/400"></core-image>
35 Will crop the image to fit:
37 <core-image style="width:400px; height:400px;" sizing="cover"
38 src="http://lorempixel.com/600/400"></core-image>
40 Will show light-gray background until the image loads:
42 <core-image style="width:400px; height:400px; background-color: lightgray;"
43 sizing="cover" preload src="http://lorempixel.com/600/400"></core-image>
45 Will show a base-64 encoded placeholder image until the image loads:
47 <core-image style="width:400px; height:400px;" placeholder="data:image/gif;base64,..."
48 sizing="cover" preload src="http://lorempixel.com/600/400"></core-image>
50 Will fade the light-gray background out once the image is loaded:
52 <core-image style="width:400px; height:400px; background-color: lightgray;"
53 sizing="cover" preload fade src="http://lorempixel.com/600/400"></core-image>
56 @group Polymer Core Elements
57 @element core-image
58 @homepage github.io
59 --><html><head><link rel="import" href="../polymer/polymer.html">
61 </head><body><polymer-element name="core-image" assetpath="">
62 <template>
63 <link rel="stylesheet" href="core-image.css">
64 <template if="{{!sizing}}">
65 <img id="img">
66 </template>
67 <template if="{{preload &amp;&amp; fade}}">
68 <div id="placeholder" fit=""></div>
69 </template>
70 <content></content>
71 </template>
73 </polymer-element>
74 <script src="core-image-extracted.js"></script></body></html>