with(['icon', 'iconGray'])->all(); } public function actionImage(Request $request) { $img = Image::find()->where([ 'sha256' => $request->getQueryParam('sha256') ])->one(); if (!$img) { throw new NotFoundHttpException(); } \Yii::$app->response->format = Response::FORMAT_RAW; \Yii::$app->response->headers->set('Content-Type', $img->mime); return file_get_contents(env('UPLOADS_PATH') . '/' . $img->sha256); } public function verbs() { return [ 'index' => [ 'GET' ], ]; } }