Get assets hashed names when needed

Another quick question about assets. Sorry about my two posts today. I was researching about hours with no luck, but I think it may be relatively simple.

Is it possible to get assets names in the same way as assets URIs? I need to pass the right asset name to this function:

$mpdf = new \Mpdf\Mpdf([

        'fontDir' => array_merge($fontDirs, [
            WP_CONTENT_DIR . '/themes/sj/dist/fonts/',

        'fontdata' => $fontData + [
          'asap' => [
            'R' => "asap-regular-TTF.ttf",

I need to get asap-regular-TTF.ttf hashed when needed.

Thank you and sorry again for the new petition.


$name = substr(strrchr($asap_regular, "/"), 1);

That seems a bit fragile. I’d consider doing something like $name = basename($asap_regular);.

1 Like

Much better! Thank you

1 Like