<p>The <code>transformId=45</code> param in the transform generation URL doesn't reference the ID for an asset, but the ID for a particular image transform operation in the <code>imagetransformindex</code> database table.</p>
<p>The only way to figure out which asset the transform with the ID <code>45</code> is operating on, is to inspect your database's <code>imagetransformindex</code> table, and look at the row with the primary key (i.e. <code>id</code>) <code>45</code>. This row will have a column called <code>assetId</code>, which references the asset being transformed by this specific transform. The row will also contain other information, such as the asset filename.</p>
<p>If you prefer, you can also get to the asset ID by writing a custom query in a Twig template:</p>
<pre><code>{% set assetId = craft.query()
    .select('assetId')
    .from('{{%imagetransformindex}}')
    .where({
      id: 45
    })
    .scalar()
%}
</code></pre>
<p>Once you've the determined the asset ID, you can try to find it in the <code>assets</code> database table (it's primary key column <code>id</code> is the ID), or you can visit this URL to have Craft serve up the asset's control panel edit page (assuming the asset exists; if not then Craft will throw a 404):</p>
<pre><code>https://example.com/admin/edit/{assetId}
</code></pre>
<p>(Replace <code>https://example.com/admin</code> with the actual URL to your Craft control panel.)</p>
<p>Or, you can also use Twig to dump it:</p>
<pre><code>{% dd craft.assets.id(1234).one() %}
</code></pre>
<blockquote>
<p>is there a way to retrieve asset data/info from the cli</p>
</blockquote>
<p>There isn't a dedicated command for it, but the <a href="https://craftcms.com/docs/5.x/reference/cli.html#exec" rel="nofollow noreferrer"><code>exec</code></a> command can run PHP code over CLI, so you could do something like</p>
<pre><code>php craft exec &quot;print_r(Craft::\$app-&gt;getAssets()-&gt;getAssetById(1234));&quot;
</code></pre>

CC BY-SA 4.0
2024-04-30T22:21:07.077Z
2024-04-30T22:30:41.477Z
2024-04-30T22:30:41.477Z
Mats Mikkel Rummelhoff
<p>I have assets configured via azure blob storage and sometimes one of 2 issues is happening :</p>
<p><code>01.</code> The asset url remains as <code>/en/actions/assets/generate-transform?transformId=45</code></p>
<p>In this case i would check the blob connection string, which normally solves the issue.</p>
<p><code>02.</code> Other times the same url <code>/en/actions/assets/generate-transform?transformId=45</code> resolves to a 404 page not found.</p>
<p>My question(s) is/are :</p>
<p><code>01.</code> is there a way to determine which asset, in this case 45, it is pointing to ? From the admin, i cannot find asset 45, since there is also a sub-directory structure and i would need to know the name.</p>
<p><code>02.</code> is there a way to retrieve asset data/info from the cli ? is there a command for it?</p>
<p>Thanks for your help, hope I provided all the details.</p>
<p>AR</p>

<assets><craft4><cli>
How to get info about an asset via cli?
# How to get info about an asset via cli?

(Asked by: username_0 on 2024-04-30)

I have assets configured via azure blob storage and sometimes one of 2 issues is happening :

`01.` The asset url remains as `/en/actions/assets/generate-transform?transformId=45`

In this case i would check the blob connection string, which normally solves the issue.

`02.` Other times the same url `/en/actions/assets/generate-transform?transformId=45` resolves to a 404 page not found.

My question(s) is/are :

`01.` is there a way to determine which asset, in this case 45, it is pointing to ? From the admin, i cannot find asset 45, since there is also a sub-directory structure and i would need to know the name.

`02.` is there a way to retrieve asset data/info from the cli ? is there a command for it?

Thanks for your help, hope I provided all the details.

AR

**Tags:** assets, craft4, cli

---

## 1 answers

### Answer by username_1 on 2024-04-30. Score: 1

The transformId=45 param in the transform generation URL doesn't reference the ID for an asset, but the ID for a particular image transform operation in the imagetransformindex database table.
The only way to figure out which asset the transform with the ID 45 is operating on, is to inspect your database's imagetransformindex table, and look at the row with the primary key (i.e. id) 45. This row will have a column called assetId, which references the asset being transformed by this specific transform. The row will also contain other information, such as the asset filename.
If you prefer, you can also get to the asset ID by writing a custom query in a Twig template:
{% set assetId = craft.query()
    .select('assetId')
    .from('{{%imagetransformindex}}')
    .where({
      id: 45
    })
    .scalar()
%}

Once you've the determined the asset ID, you can try to find it in the assets database table (it's primary key column id is the ID), or you can visit this URL to have Craft serve up the asset's control panel edit page (assuming the asset exists; if not then Craft will throw a 404):
https://example.com/admin/edit/{assetId}

(Replace https://example.com/admin with the actual URL to your Craft control panel.)
Or, you can also use Twig to dump it:
{% dd craft.assets.id(1234).one() %}


is there a way to retrieve asset data/info from the cli

There isn't a dedicated command for it, but the exec command can run PHP code over CLI, so you could do something like
php craft exec "print_r(Craft::\$app->getAssets()->getAssetById(1234));"


---

