Add Image Block to a Page
Permalink 1 user found helpful
Hi everyone,
I've trying to add a Image Blocktype to a Page how i create, i can add the content fine, but when i try to add an Image the C5 don't recognize.
My code:
$fi = new FileImporter();
$resp = $fi->import($dir . $noticia['noticia_chamada_imagem'], $noticia['noticia_chamada_imagem'], $fr);
if (is_object($resp)) {
$thumbID = $resp->getFileID();
$bt = BlockType::getByHandle('Image');
$data = array('content' => $resp);
$p->addBlock($bt, 'Thumbnail Image', $data);
}
The Page inclusion its OK, when i import the page this blocks show "Image Not Found".
Thank you for your help :-)
I've trying to add a Image Blocktype to a Page how i create, i can add the content fine, but when i try to add an Image the C5 don't recognize.
My code:
$fi = new FileImporter();
$resp = $fi->import($dir . $noticia['noticia_chamada_imagem'], $noticia['noticia_chamada_imagem'], $fr);
if (is_object($resp)) {
$thumbID = $resp->getFileID();
$bt = BlockType::getByHandle('Image');
$data = array('content' => $resp);
$p->addBlock($bt, 'Thumbnail Image', $data);
}
The Page inclusion its OK, when i import the page this blocks show "Image Not Found".
Thank you for your help :-)
Solution:
$fi = new FileImporter();
$resp = $fi->import($dir . $noticia['noticia_chamada_imagem'], $noticia['noticia_chamada_imagem'], $fr);
//$thumbFile = $this->fileset->addFileToSet($resp);
if (is_object($resp)) {
$thumbID = $resp->getFileID();
$bt = BlockType::getByHandle('Image');
$data = array('fID' => $thumbID);
$p->addBlock($bt, 'Thumbnail Image', $data);
//$p->setAttribute('thumbnail', $resp);
Thank You for community :)