Using an Image Block in Composer
Permalink
I would like to have an image within a page.
Does anyone know how to add an empty image block to Composer?
I have striped the validation out of the default block so I can add an empty image, but viewing the block in composer asks me to edit the block.
Usually I do these sort of image in a page attribute, or within a designer block.
This time I need the image to be in an Image Area has anyone else done this?
Does anyone know how to add an empty image block to Composer?
I have striped the validation out of the default block so I can add an empty image, but viewing the block in composer asks me to edit the block.
Usually I do these sort of image in a page attribute, or within a designer block.
This time I need the image to be in an Image Area has anyone else done this?
I am trying to accomplish basically the same thing. I want to use the built-in image cropper in a composer template, but I need the block to exist in the the page type without an image selected.
You say you copied the edit.php contents into a file called composer.php and made some alterations; where did you put the composer.php file?
You say you copied the edit.php contents into a file called composer.php and made some alterations; where did you put the composer.php file?
The composer file goes into the the image folder at the same level as the edit file, if you are using the built in image crop tool though I believe it has a folder called composer with some tools in?
To remove the validation for the image, in the controller you can comment out the following function.
I do not think this gives and error if no image is selected as the controller appears to have the checks in place to ensure an image id is available.
My composer file uses the following(this is for a custom image block I have created). It take an image and allows for it to be cropped, via defined dimensions but uses the getThumbnail function to do the cropping.
To remove the validation for the image, in the controller you can comment out the following function.
I do not think this gives and error if no image is selected as the controller appears to have the checks in place to ensure an image id is available.
public function getJavaScriptStrings() { return array( 'image-required' => t('You must select an image.') ); }
My composer file uses the following(this is for a custom image block I have created). It take an image and allows for it to be cropped, via defined dimensions but uses the getThumbnail function to do the cropping.
<?php defined('C5_EXECUTE') or die(_("Access Denied.")); $altText = $controller->altText; $thumbnailWidth = ($controller->thumbnailWidth)?$controller->thumbnailWidth:300; $thumbnailHeight = ($controller->thumbnailHeight)?$controller->thumbnailHeight:500; $includeAssetLibrary = true; $assetLibraryPassThru = array( 'type' => 'image' ); $al = Loader::helper('concrete/asset_library'); $bf = null; if ($controller->getFileID() > 0) { $bf = $controller->getFileObject(); } ?>
Viewing 15 lines of 37 lines. View entire code block.
By default, the block is displayed with and edit option as no composer file exists.
I created a file called composer.php and copied in the edit.php content
I have tweaked this to fit the area, (I have a template which adjusts the size to fit the area) and I do not want an image link or image swap
This was the code I used