Answers.Body: <p>It looks like you're using a Matrix block with a field inside a block called Image. Given that information, I'd add a new field to that block called Border. You could either use a colour field, or a dropdown to set your own values. Then maybe something like this on the front end:</p>
  
  <pre><code>{% if block.image|length %}
  &lt;img src="{{ block.image.one.url }}" {% if block.border|length %} class="bordered border-{{ block.border }}"{% endif %}&gt;
  {% endif %}
  </code></pre>
  
  <p>Craft doesn't have any relation to the front end of your site intrinsically, so you could call the field whatever you like.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-08-15T11:38:04.400Z
Answers.Text: Ahh, yes - I'd totally missed that I could do that. Thanks Daryl.
Answers.UserDisplayName: carljwood
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-08-15T11:22:30.143Z
Answers.LastActivityDate: 2018-08-15T11:22:30.143Z
Answers.UserDisplayName: darylknight
Body: <p>My first question here... maybe one of a few! I've inherited a Craft project recently and don't have much experience with it.</p>
  
  <p>I want to allow admin to set a border (and border color) whenever they add an image. Currently, the <code>image</code> field has a field type of <code>Assets</code>. I don't want to change the field type (to a <code>Super Table</code> or similar) because the component is used in so many other places - it would break.</p>
  
  <p>We're using Craft 2 but upgrading to 3 presently.</p>
  
  <p>Has anyone else had to do this before? Any suggestions on how to approach this? Let me know if I can clarify anything.</p>
  
  <p><a href="https://i.sstatic.net/bob5v.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/bob5v.png" alt="enter image description here"></a></p>
  
Tags: <assets><field><image>
Title: How to create a border + border colour field on an image
ThreadText: # How to create a border + border colour field on an image
  
  (Asked by: username_0 on 2018-08-15)
  
  My first question here... maybe one of a few! I've inherited a Craft project recently and don't have much experience with it.
  
  I want to allow admin to set a border (and border color) whenever they add an image. Currently, the `image` field has a field type of `Assets`. I don't want to change the field type (to a `Super Table` or similar) because the component is used in so many other places - it would break.
  
  We're using Craft 2 but upgrading to 3 presently.
  
  Has anyone else had to do this before? Any suggestions on how to approach this? Let me know if I can clarify anything.
  
  [![enter image description here](https://i.sstatic.net/bob5v.png)](https://i.sstatic.net/bob5v.png)
  
  **Tags:** assets, field, image
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2018-08-15. Score: 1 | Accepted answer
  
  It looks like you're using a Matrix block with a field inside a block called Image. Given that information, I'd add a new field to that block called Border. You could either use a colour field, or a dropdown to set your own values. Then maybe something like this on the front end:
  
  ```
  {% if block.image|length %}
  <img src="{{ block.image.one.url }}" {% if block.border|length %} class="bordered border-{{ block.border }}"{% endif %}>
  {% endif %}
  
  ```
  
  Craft doesn't have any relation to the front end of your site intrinsically, so you could call the field whatever you like.
  
  > **Comments:**
  > **username_0**: Ahh, yes - I'd totally missed that I could do that. Thanks Daryl.  
  
  ---
  
  