PartKeepr\UploadedFileBundle\Controller\FileController::getMimeTypeIconAction PHP Method

getMimeTypeIconAction() public method

Returns the mimetype icon for an uploaded file.
public getMimeTypeIconAction ( integer $id ) : Response
$id integer The ID of the entity
return Symfony\Component\HttpFoundation\Response
    public function getMimeTypeIconAction($id)
    {
        /**
         * @var EntityManager
         */
        $em = $this->getDoctrine()->getManager();
        /**
         * @var UploadedFile
         */
        $file = $em->find($this->getEntityClass(), $id);
        $icon = $this->get('partkeepr_mimetype_icon_service')->getMimetypeIcon($file->getMimeType());
        return new Response(file_get_contents($icon), 200, ['Content-Type' => 'image/svg+xml']);
    }