When I can add new image by REST API (as update by PUT method) new image into the existing array of imageges there is no possibility to combine "base64 data" and "fid reference to just stored image" , see:
[ "data:image/jpeg;base64,<base64>", {"fid": "<number>"}, ... ]

PUT of this json code will create log entry:

Warning: preg_split() expects parameter 2 to be string, object given in function restws_file_create_files() (line: 119 in file /home/domains/aaaakce.cz/node0/domain_home/www/sites/all/modules/restws_file/restws_file.module).

It means so, {"fid": "<number>"} produce non-string value ;)

It can be imply resolve by adding this code on line 119 (see attached patch):

    if (!is_string($enc_contents_item)) {
          array_push($fid_array, $enc_contents_item);
          continue;
    }
CommentFileSizeAuthor
enable-fid.patch706 bytesmarek.veber

Comments

marek.veber created an issue. See original summary.

marek.veber’s picture

Issue summary: View changes
marek.veber’s picture

Issue summary: View changes
mariano.barcia’s picture

Title: cannot reuse just stored file by fid » Ability to update field using an existing fid
Category: Bug report » Task
Status: Active » Needs review

@marek.veber, thank you for pointing this out AND providing a patch!

It looks very good.

As soon as I find the time during the holidays I'll test it and hopefully issue a new release.

Cheers,
--mariano

  • mariano.barcia committed 4e8cb56 on 7.x-1.x
    Issue #2638996 by marek.veber, mariano.barcia: Added ability to update...
mariano.barcia’s picture

Status: Needs review » Fixed

Added in the new release 1.1. @marek.veber I've given you proper credit for this, thank you very much.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.