image: refactor to use arg for body
parent
33797c5898
commit
2b0afe8db6
|
@ -213,8 +213,9 @@ class ImageController extends ApiBase
|
||||||
* Set the exif data for a file.
|
* Set the exif data for a file.
|
||||||
*
|
*
|
||||||
* @param string fileid
|
* @param string fileid
|
||||||
|
* @param array raw exif data
|
||||||
*/
|
*/
|
||||||
public function setExif(string $id): JSONResponse
|
public function setExif(string $id, array $raw): JSONResponse
|
||||||
{
|
{
|
||||||
$file = $this->getUserFile((int) $id);
|
$file = $this->getUserFile((int) $id);
|
||||||
if (!$file) {
|
if (!$file) {
|
||||||
|
@ -232,11 +233,10 @@ class ImageController extends ApiBase
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get original file from body
|
// Get original file from body
|
||||||
$exif = $this->request->getParam('raw');
|
|
||||||
$path = $file->getStorage()->getLocalFile($file->getInternalPath());
|
$path = $file->getStorage()->getLocalFile($file->getInternalPath());
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Exif::setExif($path, $exif);
|
Exif::setExif($path, $raw);
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
return new JSONResponse(['message' => $e->getMessage()], Http::STATUS_INTERNAL_SERVER_ERROR);
|
return new JSONResponse(['message' => $e->getMessage()], Http::STATUS_INTERNAL_SERVER_ERROR);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue