Skip to content

[6.x] SVG is not displayed in Asset fieldtype Grid view #13400

@mikemartin

Description

@mikemartin

Bug description

When the Asset Grid view is used, the SVG image shrinks and is not displayed properly.
Image

In /fieldtypes/assets/AssetTile it looks like the thumbnail template is showing instead of the canShowSVG template but we should also add size-full to the svg template.

Suggested fix on line 28:

<template v-else>
    <img v-if="canShowSvg" :src="asset.url" :title="label" class="p-4 size-full" /> // added size-full

    <template v-else>
        <img :src="thumbnail" v-if="thumbnail" :title="label" class="rounded-md"  />

        <file-icon v-else :extension="asset.extension" class="h-full w-full p-4" />
    </template>
</template>

How to reproduce

  • Add Asset fieldtype
  • Set mode to Grid
  • Browse and select SVG image

Logs

Environment

Environment ........................................................................................................  
  Application Name .......................................................................................... Statamic  
  Laravel Version ............................................................................................ 12.43.1  
  PHP Version ................................................................................................. 8.2.29  
  Composer Version ............................................................................................ 2.8.11  
  Environment .................................................................................................. local  
  Debug Mode ................................................................................................. ENABLED  
  URL ............................................................................................... hiddenitaly.test  
  Maintenance Mode ............................................................................................... OFF  
  Timezone ....................................................................................................... UTC  
  Locale .......................................................................................................... en  

  Cache ..............................................................................................................  
  Config .................................................................................................. NOT CACHED  
  Events .................................................................................................. NOT CACHED  
  Routes .................................................................................................. NOT CACHED  
  Views ....................................................................................................... CACHED  

  Drivers ............................................................................................................  
  Broadcasting ................................................................................................... log  
  Cache ......................................................................................................... file  
  Database .................................................................................................... sqlite  
  Logs ................................................................................................ stack / single  
  Mail ........................................................................................................... log  
  Queue ......................................................................................................... sync  
  Session ....................................................................................................... file  

  Storage ............................................................................................................  
  public/storage .......................................................................................... NOT LINKED  

  Livewire ...........................................................................................................  
  Livewire .................................................................................................... v3.7.2  

  Statamic ...........................................................................................................  
  Addons ........................................................................................................... 2  
  Sites ............................................................................................................ 1  
  Stache Watcher ...................................................................................... Enabled (auto)  
  Static Caching ............................................................................................ Disabled  
  Version ........................................................................................ 6.0.0-alpha.20 Solo  

  Statamic Addons ....................................................................................................  
  marcorieser/statamic-livewire ....................................................................... dev-statamic-6  
  reachweb/statamic-livewire-filters .................................................................. dev-statamic-6

Installation

Fresh statamic/statamic site via CLI

Additional details

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions