create image thumbnails from multiple files attribute package

Permalink
Hi,

I would like to achieve adding more images to a blog post, and for that I have installed thehttps://www.concrete5.org/marketplace/addons/multiple-files-attribut... package.

It works really great and supports the composer as well, but the only thing that is causing me trouble like hell, is that I can not manipulate with the images I get. They are only displayed from the following code of the attribute controller of the package :

public function getDisplayValue()
    {
        $html = '';
        $filesValue = $this->attributeValue->getValue();
        if (is_object($filesValue)) {
            $filesArray = $filesValue->getFileObjects();
            if (count($filesArray) > 0) {
                $this->addHeaderItem(\Core::make('helper/html')->css('/'.DIRNAME_PACKAGES.'/pure_multiple_files/attributes/pure_multiple_files/view.css'));
                $html .= '<div class="display_multiple_files multiple_files_akID_'.$this->getAttributeKey()->getAttributeKeyID().'">';
                foreach ($filesArray as $file) {
                    /** @var \Concrete\Core\File\File $file */
                    $fv = $file->getRecentVersion();
                    $html .= '<div class="file">';
                        $html .= '<div class="thumb">';
                            $html .= '<a href="'.$fv->getDownloadURL().'" title="'.$fv->getTitle().'">';


What I would like to achieve is, that I would like to fetch the files from the array from the page_attribute and then create/display image thumbnails in correct sizes like I've done here:
$thumbnail = $c->getAttribute("thumbnail");
if (is_object($thumbnail)) {
    $type = \Concrete\Core\File\Image\Thumbnail\Type\Type::getByHandle('medium');
    $type->setWidth("340");
    $type->setHeight("255");
    $image_url = $thumbnail->getThumbnailURL($type->getDoubledVersion());


I just can't figure out how I can do this.. I've tried different things like getting the files from fID, but when I do
File::getByID($fID);

But although I get an object, when I try to manipulate it, I get a message that it is null :-(

Can anyone help me achieve getting the array of images and being able to work with them?

All help is VERY appreciated!!

pixel8
 
hutman replied on at Permalink Reply
hutman
You should be able to do something like this

$c = Page::getCurrentPage(); 
$fileArray = $c->getAttribute('multiple_file_attribute_handle')->getFileObjects();
if(is_array($fileArray)){
    foreach($fileArray as $file){
        echo $file->getURL().'<br />';
    }
}