Uploads

Demo of file and images uploading.


public function uploads()
{
  // remember to set Xcrud::$upload_folder_def; the path to your uploads folder 
  // in xcrud_config.php in relation to xcrud_config.php

  $xcrud = get_xcrud();
  $xcrud->table('uploads');

  // simple file upload
  $xcrud->change_type('simple_upload', 'file', '', array('not_rename'=>true));
   
  // simple image upload
  $xcrud->change_type('simple_image', 'image');
   
  // image upload with resizing
  $xcrud->change_type('auto_resize', 'image', '', array('width' => 200, 'height' => 200));
   
  // image upload with resizing
  $xcrud->change_type('auto_crop', 'image', '', array(
    'width' => 200,
    'height' => 200,
    'crop' => true));
   
  // image upload with manual crop
  $xcrud->change_type('manual_crop', 'image', '', array('manual_crop' => true));
   
  // image upload with manual crop and resizing
  $xcrud->change_type('manual_crop_2', 'image', '', array(
    'width' => 200,
    'height' => 200,
    'manual_crop' => true));
   
  // image upload with manual crop and fixed ratio
  $xcrud->change_type('manual_crop_3', 'image', '', array('ratio' => 0.5, 'manual_crop' => true));
   
  // image upload with watermark 
  // watermark path relative to xCRUD directory
  $xcrud->change_type('watermark', 'image', '', array('width' => 400, 'watermark' => '../../img/xCRUD.png'));
   
  // image upload with watermark position (%-left, %-top)
  // watermark path relative to xCRUD directory
  $xcrud->change_type('watermark_position', 'image', '', array('watermark' => '../../img/xCRUD.png',
    'watermark_position' => array(10, 95)));
   
  // image upload with thumbs
  // watermark path relative to xCRUD directory
  $xcrud->change_type('image_with_thumbs', 'image', '', array('thumbs' => 
    array(
      array(
        'width' => '300',
        'marker' => '_th',
        'watermark' => '../../img/xCRUD.png'), 
      array(
        'width' => 100,
        'height' => 100,
        'crop' => true,
        'folder' => 'thumbs')
      )));

  $data['content'] = $xcrud->render('edit', 14);

  return view('demos', $data);
}

Uploads - Edit

no image Add image
no image Add image
no image Add image
no image Add image
no image Add image
no image Add image
no image Add image
no image Add image
no image Add image