|
|
@ -52,7 +52,7 @@ class ImportEmojis extends Command
|
|
|
|
|
|
|
|
|
|
|
|
foreach (new \RecursiveIteratorIterator($tar) as $entry) {
|
|
|
|
foreach (new \RecursiveIteratorIterator($tar) as $entry) {
|
|
|
|
$this->line("Processing {$entry->getFilename()}");
|
|
|
|
$this->line("Processing {$entry->getFilename()}");
|
|
|
|
if (!$entry->isFile() || !$this->isImage($entry)) {
|
|
|
|
if (!$entry->isFile() || !$this->isImage($entry) || !$this->isEmoji($entry->getPathname())) {
|
|
|
|
$failed++;
|
|
|
|
$failed++;
|
|
|
|
continue;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -107,4 +107,12 @@ class ImportEmojis extends Command
|
|
|
|
$image = getimagesize($file->getPathname());
|
|
|
|
$image = getimagesize($file->getPathname());
|
|
|
|
return $image !== false;
|
|
|
|
return $image !== false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private function isEmoji($filename)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
$allowedMimeTypes = ['image/png', 'image/jpeg', 'image/webp'];
|
|
|
|
|
|
|
|
$mimeType = mime_content_type($filename);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return in_array($mimeType, $allowedMimeTypes);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|