1

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

1 Answer 1

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));"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.