This site has been archived. To learn more about our current products Ibexa Content, Ibexa Experience, Ibexa Commerce head over to the Ibexa Developer Portal
Tuesday 21 November 2017 4:43:51 pm - 2 replies
I am on a command that saves images in image fields.
$objectDraft = $this->contentService->createContentDraft($content->contentInfo); $objectUpdateStruct = $this->contentService->newContentUpdateStruct(); $objectUpdateStruct->setField('image', '/tmp/image.jpg'); $objectDraft = $this->contentService->updateContent( $objectDraft->versionInfo, $objectUpdateStruct ); $this->contentService->publishVersion($objectDraft->versionInfo);
The information seems well recorded.
But no img in the BO ...
'id' => '2/6/6/4/4662-24-fre-FR/fa6f2a0e26769bde60eee426a19cf06e.jpg', 'alternativeText' => '', 'fileName' => 'fa6f2a0e26769bde60eee426a19cf06e.jpg', 'fileSize' => 15898, 'uri' => '/var/client/storage/images/2/6/6/4/4662-24-fre-FR/fa6f2a0e26769bde60eee426a19cf06e.jpg', 'imageId' => '594-4662', 'inputUri' => NULL, 'width' => '300', 'height' => '613',
Tuesday 21 November 2017 4:46:20 pm
I also tested this technique:
$filePath = '/tmp/image.jpg'; /** @var \eZ\Publish\Core\FieldType\Image\Value $imageValue */ $imageValue = $content->getFieldValue('image'); $imageValue->inputUri = $filePath; $imageValue->alternativeText = ''; $imageValue->id = $filePath; $objectUpdateStruct->setField('image', $imageValue);
Modified on Tuesday 21 November 2017 4:47:39 pm by Rémy PHP
Tuesday 21 November 2017 4:49:02 pm
You must be logged in to post messages in this topic!