Show the NPC portrait on the detail page
Npc::getPortraitPath() maps the name to image/npc-pictures/<NameNoSpaces>.png; the edit page renders it beside the heading (with family · occupation), and drops the <img> via onerror when a portrait is missing. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -227,4 +227,14 @@ class Npc
|
||||
{
|
||||
return $this->updatedAt;
|
||||
}
|
||||
|
||||
/**
|
||||
* AssetMapper logical path of this NPC's portrait, e.g.
|
||||
* "image/npc-pictures/GarrickVoss.png". The file may not exist for
|
||||
* NPCs added after the portrait sets were generated.
|
||||
*/
|
||||
public function getPortraitPath(): string
|
||||
{
|
||||
return 'image/npc-pictures/'.str_replace(' ', '', $this->name).'.png';
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user