Jump to content

  • You cannot start a new topic
  • You cannot reply to this topic

How to upload images in an addon? Rate Topic   - - - - -

 
  • rtp
  • Newbie
  • Members
  • Join Date: 26-Aug 13
  • 2 posts

Posted 03 September 2013 - 07:33 AM #1

Hello

I'm trying to add an additional field to content pages to upload an image. I know you can insert images into the RTE, but because of design issues we need to have more control.

I tried to use the "common/attach_images.tpl" template, but I'm kinda lost on what I have to do in the controller afterwards to save the images and add them to the images Database.

Any help you guys can give me would be much appreciated
Regards

 
  • mmovies
  • Member
  • Members
  • Join Date: 30-Jul 13
  • 22 posts

Posted 03 September 2013 - 12:13 PM #2

hi,
ok first verify that. In your update form must have correctly enctype="multipart/form-data" because from install it was not declare.
after that you could add on function fn_get_page_data this
if (!empty($pages)) {
$pages['main_pair'] = fn_get_image_pairs($fans['page_id'], 'pages', 'M',true, false, $lang_code);
}

and on fn_get_pages : a least declare

foreach ($pages as $k => $v) {
$pages[$k]['main_pair'] = fn_get_image_pairs($v['page_id'], 'pages', 'M', true, false, $lang_code);
}

before doing this you have to adapt var names may be.
Hoope it could help you
best regards