@@ -200,7 +200,7 @@ private static function _call(OkapiRequest $request)
200
200
201
201
try
202
202
{
203
- $ position = self ::db_insert_image (
203
+ list ( $ position, $ image_url ) = self ::db_insert_image (
204
204
$ request ->consumer ->key , $ request ->token ->user_id ,
205
205
$ log_internal_id , $ image_uuid , $ position , $ caption , $ is_spoiler , $ file_ext
206
206
);
@@ -216,7 +216,7 @@ private static function _call(OkapiRequest $request)
216
216
throw $ e ;
217
217
}
218
218
219
- return array ($ image_uuid , $ position );
219
+ return array ($ image_uuid , $ position, $ image_url );
220
220
}
221
221
222
222
/**
@@ -333,6 +333,7 @@ private static function db_insert_image(
333
333
"NOW(), NOW(), '', 0, NOW(), ' " .Db::escape_string ($ user_id )."' " ;
334
334
}
335
335
336
+ $ image_url = Settings::get ('IMAGES_URL ' ).$ image_uuid .$ file_ext ;
336
337
Db::execute ("
337
338
insert into pictures (
338
339
uuid, node, local, title, spoiler, url, object_type, object_id,
@@ -345,7 +346,7 @@ private static function db_insert_image(
345
346
1,
346
347
' " .Db::escape_string ($ caption )."',
347
348
' " .($ is_spoiler == 'true ' ? 1 : 0 )."',
348
- ' " .Db::escape_string (Settings:: get ( ' IMAGES_URL ' ). $ image_uuid . $ file_ext )."',
349
+ ' " .Db::escape_string ($ image_url )."',
349
350
1,
350
351
' " .Db::escape_string ($ log_internal_id )."',
351
352
0,
@@ -386,7 +387,7 @@ private static function db_insert_image(
386
387
Db::execute ('commit ' );
387
388
Db::execute ('unlock tables ' );
388
389
389
- return $ position ;
390
+ return array ( $ position, $ image_url ) ;
390
391
}
391
392
392
393
@@ -401,11 +402,12 @@ public static function call(OkapiRequest $request)
401
402
402
403
try
403
404
{
404
- list ($ image_uuid , $ position ) = self ::_call ($ request );
405
+ list ($ image_uuid , $ position, $ image_url ) = self ::_call ($ request );
405
406
$ result = array (
406
407
'success ' => true ,
407
408
'message ' => _ ("Image has been successfully saved. " ),
408
409
'image_uuid ' => $ image_uuid ,
410
+ 'image_url ' => $ image_url ,
409
411
'position ' => $ position
410
412
);
411
413
Okapi::gettext_domain_restore ();
@@ -417,6 +419,7 @@ public static function call(OkapiRequest $request)
417
419
'success ' => false ,
418
420
'message ' => $ e ->getMessage (),
419
421
'image_uuid ' => null ,
422
+ 'image_url ' => null ,
420
423
'position ' => null
421
424
);
422
425
}
0 commit comments