Skip to content

Commit

Permalink
remove png references in core
Browse files Browse the repository at this point in the history
  • Loading branch information
Henni authored and Vincent Petry committed Jul 1, 2016
1 parent 769deae commit 11be3d6
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 18 deletions.
15 changes: 4 additions & 11 deletions core/js/mimetype.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ OC.MimeType = {
* Cache that maps mimeTypes to icon urls
*/
_mimeTypeIcons: {},

/**
* Return the file icon we want to use for the given mimeType.
* The file needs to be present in the supplied file list
Expand Down Expand Up @@ -60,7 +60,7 @@ OC.MimeType = {

return null;
},

/**
* Return the url to icon of the given mimeType
*
Expand Down Expand Up @@ -91,25 +91,18 @@ OC.MimeType = {
path += icon;
}
}

// If we do not yet have an icon fall back to the default
if (gotIcon === null) {
path = OC.webroot + '/core/img/filetypes/';
path += OC.MimeType._getFile(mimeType, OC.MimeTypeList.files);
}

// Use svg if we can
if(OC.Util.hasSVGSupport()){
path += '.svg';
} else {
path += '.png';
}
path += '.svg';

// Cache the result
OC.MimeType._mimeTypeIcons[mimeType] = path;
return path;
}

};


12 changes: 6 additions & 6 deletions lib/private/Files/Type/Detection.php
Original file line number Diff line number Diff line change
Expand Up @@ -283,21 +283,21 @@ public function mimeTypeIcon($mimetype) {

// Is it a dir?
if ($mimetype === 'dir') {
$this->mimetypeIcons[$mimetype] = $this->urlGenerator->imagePath('core', 'filetypes/folder.png');
$this->mimetypeIcons[$mimetype] = $this->urlGenerator->imagePath('core', 'filetypes/folder.svg');
return $this->mimetypeIcons[$mimetype];
}
if ($mimetype === 'dir-shared') {
$this->mimetypeIcons[$mimetype] = $this->urlGenerator->imagePath('core', 'filetypes/folder-shared.png');
$this->mimetypeIcons[$mimetype] = $this->urlGenerator->imagePath('core', 'filetypes/folder-shared.svg');
return $this->mimetypeIcons[$mimetype];
}
if ($mimetype === 'dir-external') {
$this->mimetypeIcons[$mimetype] = $this->urlGenerator->imagePath('core', 'filetypes/folder-external.png');
$this->mimetypeIcons[$mimetype] = $this->urlGenerator->imagePath('core', 'filetypes/folder-external.svg');
return $this->mimetypeIcons[$mimetype];
}

// Icon exists?
try {
$this->mimetypeIcons[$mimetype] = $this->urlGenerator->imagePath('core', 'filetypes/' . $icon . '.png');
$this->mimetypeIcons[$mimetype] = $this->urlGenerator->imagePath('core', 'filetypes/' . $icon . '.svg');
return $this->mimetypeIcons[$mimetype];
} catch (\RuntimeException $e) {
// Specified image not found
Expand All @@ -306,13 +306,13 @@ public function mimeTypeIcon($mimetype) {
// Try only the first part of the filetype
$mimePart = substr($icon, 0, strpos($icon, '-'));
try {
$this->mimetypeIcons[$mimetype] = $this->urlGenerator->imagePath('core', 'filetypes/' . $mimePart . '.png');
$this->mimetypeIcons[$mimetype] = $this->urlGenerator->imagePath('core', 'filetypes/' . $mimePart . '.svg');
return $this->mimetypeIcons[$mimetype];
} catch (\RuntimeException $e) {
// Image for the first part of the mimetype not found
}

$this->mimetypeIcons[$mimetype] = $this->urlGenerator->imagePath('core', 'filetypes/file.png');
$this->mimetypeIcons[$mimetype] = $this->urlGenerator->imagePath('core', 'filetypes/file.svg');
return $this->mimetypeIcons[$mimetype];
}
}
2 changes: 1 addition & 1 deletion lib/private/Preview/MP3.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public function getThumbnail($path, $maxX, $maxY, $scalingup, $fileview) {
* @return bool|\OCP\IImage false if the default image is missing or invalid
*/
private function getNoCoverThumbnail() {
$icon = \OC::$SERVERROOT . '/core/img/filetypes/audio.png';
$icon = \OC::$SERVERROOT . '/core/img/filetypes/audio.svg';

if(!file_exists($icon)) {
return false;
Expand Down

0 comments on commit 11be3d6

Please sign in to comment.