Adding an image field

Permalink Browser Info Environment
Hi Jordan

Just created a very long block so did not want to re create and just wanted to add an extra image field. All field numbers currently go up to field_22 so did the following

1. In db.xml added <field name="field_23_image_fID" type="I"></field>

2. In edit.php added <?php echo $al->image('field_23_image_fID', 'field_23_image_fID', 'Choose Image', $field_23_image); ?>

3. In controller.php added to public function view() { the following $this->set('field_23_image', (empty($this->field_23_image_fID) ? null : $this->get_image_object($this->field_23_image_fID, 100, 50, true)));
and
to public function edit() { $this->set('field_23_image', (empty($this->field_23_image_fID) ? null : File::getByID($this->field_23_image_fID)));
and to public function save($args) { $args['field_23_image_fID'] = empty($args['field_23_image_fID']) ? 0 : $args['field_23_image_fID'];

4. in view.php added the following <img src="<?php echo $field_2_image->src; ?>" onmouseover="this.src='<?php echo $field_23_image->src; ?>'" onmouseout="this.src='<?php echo $field_2_image->src; ?>'"

Now if i go into edit I see the extra image selection field and select image and then save. When I come to view I don't get any result for the added image filed as below
<img src="/files/cache/1ddce7d51fcf3659f12f1f9a9a52ff62_f49.png" onmouseover="this.src=''" onmouseout="this.src='/files/cache/1ddce7d51fcf3659f12f1f9a9a52ff62_f49.png'" width="99" height="46" alt="test colour">

Have I missed adding any other data ?

Type: Discussion
Status: New
Responsive
View Replies: View Best Answer
jordanlev replied on at Permalink Best Answer Reply
jordanlev
You'll need to "refresh" the block via the dashboard (go to the dashboard "Block Types" page, click on this block type in the list, then click the "Refresh" button). This will tell c5 to apply the scheme change you made in db.xml to the database.

-Jordan

> On Oct 13, 2014, at 6:09 AM, concrete5 Community <discussions@concretecms.com> wrote:
Responsive replied on at Permalink Reply
Responsive
Thank you Jordan

concrete5 Environment Information

Browser User-Agent String

Hide Post Content

This will replace the post content with the message: "Content has been removed by an Administrator"

Hide Content

Request Refund

You have not specified a license for this support ticket. You must have a valid license assigned to a support ticket to request a refund.