Closed
Description
Need to add code to Request.php method:
private static function mediaInputHelper($item, &$has_resource, array &$multipart)
{
...
foreach ($item as $media_item) {
...
<-- to put here -->
}
}
Code to add:
if (!empty($thumb)) {
// Allow absolute paths to local files.
if (is_string($thumb) && file_exists($thumb)) {
$thumb = new Stream(self::encodeFile($thumb));
}
if (is_resource($thumb) || $thumb instanceof Stream) {
$has_resource = true;
$rnd_key = uniqid('media_', false);
$multipart[] = ['name' => $rnd_key, 'contents' => $thumb];
// We're literally overwriting the passed media data!
$media_item->thumb = 'attach://' . $rnd_key;
$media_item->raw_data['thumb'] = 'attach://' . $rnd_key;
}
}