Add an image to a composer page

Permalink
Hello All

Im working on a site where a client need to post a news style page 2-3 times a day. I have built the site using C5, and built the news feed using the composer. I have created the attributes and built the composer page. So far everything is going great, and I am really happy with the simplicity of the composer form and how easy it would be for the client to use.

Where I am stuck is the client would like the option to upload an image to be placed on the page. I have created an attribute for an image upload, as well as created a spot on the page where the client would like the image to appear all the time.

What I am looking for is a suggestion on code to use to connect the attribute to the page. Searching through the forum I found the following code

$file = $page->getAttribute("file_attribute_handle");
if (is_object($file)) {
$im = Loader::helper('image');
$im->output($file);
}

If this code that I am looking for could some please let me know.

I appreciate all the help

Cheers,

Jeff D

jeffduns
 
A3020 replied on at Permalink Reply
A3020
Do you want the image to be resized?

$ih = Loader::helper('image');
echo $ih->outputThumbnail($c->getAttribute('ak_handle'), 250, 200, null, false, true);


For the parameters, check out the image helper:https://github.com/concrete5/concrete5/blob/master/web/concrete/core...