Example #1
0
 function upload_it()
 {
     //load the helper
     //$this->load->helper('form');
     //Configure
     //set the path where the files uploaded will be copied. NOTE if using linux, set the folder to permission 777
     $config['upload_path'] = './assets/front/img/portfolio_images';
     // set the filter image types
     $config['allowed_types'] = 'gif|jpg|png';
     //load the upload library
     $this->load->library('upload', $config);
     $this->upload->initialize($config);
     //$this->upload->set_allowed_types('*');
     $data['upload_data'] = '';
     //if not successful, set the error message
     if (!$this->upload->do_upload('userfile')) {
         redirect(base_url() . "Portfolio_ajout?op=failed", "location");
     } else {
         //else, set the success message
         $data = array('msg' => "Upload success!");
         $dataa = $this->upload->data();
         $this->load->model('entities/PortfolioEntry');
         $temp = new PortfolioEntry();
         $temp->initialize($this->input->post(), $dataa);
         PortfolioManagement::insert_portfolio_entry($temp);
         echo $dataa['file_name'];
         $data['upload_data'] = $this->upload->data();
         redirect(base_url() . "Portfolio_ajout?op=success", "location");
     }
 }
Example #2
0
<?php

/**
 * The Template for displaying all single portfolio posts.
 *
 * @package WordPress
 * @subpackage Boilerplate
 * @since Boilerplate 1.0
 */
$data = Timber::get_context();
$pi = new PortfolioEntry();
$data['post'] = $pi;
if ($pi->custom_title_tag) {
    $data['wp_title'] = $pi->custom_title_tag . ' - Upstatement Portfolio';
} else {
    $data['wp_title'] = 'Upstatement Portfolio - ' . $pi->title();
}
if ($pi->custom_description) {
    $data['meta_desc'] = $pi->custom_description;
} else {
    $data['meta_desc'] = strip_tags($pi->get_preview(30, true, '', true));
}
$plist = array('post_type' => 'portfolio', 'meta_key' => '_thumbnail_id', 'numberposts' => '6', 'post__not_in' => array($pi->ID));
$data['plist'] = Timber::get_posts($plist);
$fp = new TimberPost(3251);
$fp->squares = get_field('squares', $fp->ID);
$billboards = array();
$billboard_ids = array();
foreach ($fp->squares as $square) {
    $bb = new TimberPost($square);
    $billboard_ids[] = $bb->ID;