Answers.Body: <p>You could utilize the <a href="http://buildwithcraft.com/docs/plugins/hooks-reference#modifyAssetTableAttributes" rel="nofollow">modifyAssetTableAttributes</a> and <a href="http://buildwithcraft.com/docs/plugins/hooks-reference#getAssetTableAttributeHtml" rel="nofollow">getAssetTableAttributeHtml</a> hooks.</p>
  
  <p>So, you would create a plugin, and in the main plugin file you could add something like the following:</p>
  
  <pre><code>public function modifyAssetTableAttributes(&amp;$attributes, $source)
  {
      $attributes['filePath'] = Craft::t('File Path');
  }
  
  public function getAssetTableAttributeHtml(AssetFileModel $asset, $attribute)
  {
      if ($attribute == 'filePath')
      {
          $filePath = $asset-&gt;url;
          return $filePath;
      }
  }
  </code></pre>
  
  <p><strong>* Edit *</strong></p>
  
  <p>I did test this, and it works, but because of Craft's ability to reorganize Assets (i.e., drag them to a new folder) it's not just a simple matter of highlighting the link, copying, and pasting.</p>
  
  <p>However, by taking this example a little further, you should be able to add a little JS and have a link or something to that effect output in <code>getAssetTableAttributeHtml</code> that when clicked copies the URL to the user's clipboard. If you go this route, make sure to include the JS in your plugin's init method. Something like:</p>
  
  <pre><code>public function init()
  {
      craft()-&gt;templates-&gt;includeJsResource('yourplugin/your-js.js');
  }
  </code></pre>
  
  <p>Or (hah), for a <em>really</em> basic implementation, you could wrap the string in a URL and just have them right click and "Copy Link Address":</p>
  
  <pre><code>public function getAssetTableAttributeHtml(AssetFileModel $asset, $attribute)
  {
      if ($attribute == 'filePath')
      {
          $filePath = '&lt;a href="'.$asset-&gt;url.'"&gt;' . $asset-&gt;url . '&lt;/a&gt;';
          return $filePath;
      }
  }
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-03-04T19:57:09.853Z
Answers.LastActivityDate: 2015-03-04T20:11:32.347Z
Answers.LastEditDate: 2015-03-04T20:11:32.347Z
Answers.UserDisplayName: Peter Tell
Answers.Body: <p>You could modify the table columns shown on the asset index page and have a column for the URL. Setting this up is only possible with a plugin, but all you need to do is to add <a href="http://buildwithcraft.com/docs/plugins/hooks-reference#modifyAssetTableAttributes" rel="nofollow"><code>modifyAssetTableAttributes</code></a> and <a href="http://buildwithcraft.com/docs/plugins/hooks-reference#getAssetTableAttributeHtml" rel="nofollow"><code>getAssetTableAttributeHtml</code></a> methods to your plugins primary file and modify the table to your need as <a href="http://buildwithcraft.com/docs/plugins/hooks-reference#getAssetTableAttributeHtml" rel="nofollow">described in the docs</a>.</p>
  
  <p>Another hook you could look into with your plugin is the <a href="http://buildwithcraft.com/docs/plugins/hooks-reference#addAssetActions" rel="nofollow"><code>addAssetActions</code></a> hook.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-03-04T19:59:11.733Z
Answers.LastActivityDate: 2015-03-04T19:59:11.733Z
Answers.UserDisplayName: carlcs
Body: <p>A client wants to be able to get URLs for assets (for, eg. pasting a direct link into an email). For images and PDFs, "View file" works nicely (the file opens in a new browser tab), but for other file types which the browser can't display, they download instead. Is there any way of accessing the full URL of an asset from within the admin panel?</p>
  
  <p>(The best I've been able to suggest is that they reconstruct the URL from the folder structure of their assets, so, eg. "Files > Documents > File.xls" becomes <code>/assets/files/Documents/File.xls</code>, but it would be great if there was a less fiddly way of getting that URL)</p>
  
Tags: <assets><url><admin>
Title: Is there any easy way (via the admin panel) to get a direct link for an asset?
ThreadText: # Is there any easy way (via the admin panel) to get a direct link for an asset?
  
  (Asked by: username_0 on 2015-03-04)
  
  A client wants to be able to get URLs for assets (for, eg. pasting a direct link into an email). For images and PDFs, "View file" works nicely (the file opens in a new browser tab), but for other file types which the browser can't display, they download instead. Is there any way of accessing the full URL of an asset from within the admin panel?
  
  (The best I've been able to suggest is that they reconstruct the URL from the folder structure of their assets, so, eg. "Files > Documents > File.xls" becomes `/assets/files/Documents/File.xls`, but it would be great if there was a less fiddly way of getting that URL)
  
  **Tags:** assets, url, admin
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_1 on 2015-03-04. Score: 2
  
  You could utilize the [modifyAssetTableAttributes](http://buildwithcraft.com/docs/plugins/hooks-reference#modifyAssetTableAttributes) and [getAssetTableAttributeHtml](http://buildwithcraft.com/docs/plugins/hooks-reference#getAssetTableAttributeHtml) hooks.
  
  So, you would create a plugin, and in the main plugin file you could add something like the following:
  
  ```
  public function modifyAssetTableAttributes(&$attributes, $source)
  {
      $attributes['filePath'] = Craft::t('File Path');
  }
  
  public function getAssetTableAttributeHtml(AssetFileModel $asset, $attribute)
  {
      if ($attribute == 'filePath')
      {
          $filePath = $asset->url;
          return $filePath;
      }
  }
  
  ```
  
  **\* Edit \***
  
  I did test this, and it works, but because of Craft's ability to reorganize Assets (i.e., drag them to a new folder) it's not just a simple matter of highlighting the link, copying, and pasting.
  
  However, by taking this example a little further, you should be able to add a little JS and have a link or something to that effect output in `getAssetTableAttributeHtml` that when clicked copies the URL to the user's clipboard. If you go this route, make sure to include the JS in your plugin's init method. Something like:
  
  ```
  public function init()
  {
      craft()->templates->includeJsResource('yourplugin/your-js.js');
  }
  
  ```
  
  Or (hah), for a *really* basic implementation, you could wrap the string in a URL and just have them right click and "Copy Link Address":
  
  ```
  public function getAssetTableAttributeHtml(AssetFileModel $asset, $attribute)
  {
      if ($attribute == 'filePath')
      {
          $filePath = '<a href="'.$asset->url.'">' . $asset->url . '</a>';
          return $filePath;
      }
  }
  
  ```
  
  
  ---
  
  ### Answer by username_2 on 2015-03-04. Score: 1
  
  You could modify the table columns shown on the asset index page and have a column for the URL. Setting this up is only possible with a plugin, but all you need to do is to add [`modifyAssetTableAttributes`](http://buildwithcraft.com/docs/plugins/hooks-reference#modifyAssetTableAttributes) and [`getAssetTableAttributeHtml`](http://buildwithcraft.com/docs/plugins/hooks-reference#getAssetTableAttributeHtml) methods to your plugins primary file and modify the table to your need as [described in the docs](http://buildwithcraft.com/docs/plugins/hooks-reference#getAssetTableAttributeHtml).
  
  Another hook you could look into with your plugin is the [`addAssetActions`](http://buildwithcraft.com/docs/plugins/hooks-reference#addAssetActions) hook.
  
  
  ---
  
  