Jump to content


Moslem Mansouri

Member Since 16 Oct 2011
Offline Last Active Oct 29 2019 11:53 AM
-----

#2144 Right To Left Theme For RTL Languages

Posted Moslem Mansouri on 04 June 2012 - 09:23 AM

Updated to version 1.2.2
Please download a new file Posted Image  datatables_rtl.css   397bytes


#503 translate Issues

Posted Moslem Mansouri on 12 February 2012 - 04:21 PM

I wanted to report this problem
Yasser I did that earlier reports
You are correct that you johnny


#486 Right To Left Theme For RTL Languages

Posted Moslem Mansouri on 11 February 2012 - 02:34 PM

Hello to all

Right to left style for RTL languages :

Updated to version 1.3.2
Please download a new file Attached File  RTL.zip   10.64K   1717 downloads

Install:
1 - Please download Attached File  RTL.zip   10.64K   1717 downloads
2  - Extract to "assets\grocery_crud\themes"
3  - Confirm And Replace File And Folder
Good Luck
-----------------------
Admin please add the package to all your friends to enjoy
ThankDear Admin


#467 Items added to the library: file validation , Create thumbnail for your image...

Posted Moslem Mansouri on 08 February 2012 - 12:57 PM

Changes in the code:
I added a few lines of code
Some friends had a problem with the product thumbnail and thumbnail folders themselves did not know who should build the project.
I added the code to the destination folder and auto-thumbnailing not need to build it manually.


// Create upload path folder if it doesn't already exist
if (!is_dir($upload_path)){
mkdir($upload_path);
}

// Create Thumbnail folder if it doesn't already exist
if (!is_dir($upload_path . "Thumbnail")) {
mkdir($upload_path . "Thumbnail");
}

@web-johnny please add this code in the next version of the library
Thanks Dear Admin


#13 Issue Upload File

Posted Moslem Mansouri on 25 October 2011 - 08:19 PM

Unfortunately, the internet explorer in html5 is weak and does not support it well.
You must find a way to use that users of modern browsers.


#2 Items added to the library: file validation , Create thumbnail for your image...

Posted Moslem Mansouri on 16 October 2011 - 05:13 PM

Hello to all my friends


I'll congratulate the opening of the forum
This useful little library in my upload and delete files, edit it
Items added to the library:
1 - file validation.
2 - Create thumbnail for your images.
3 - Add numbers to the last file in the file name to avoid interference

function upload_file find, and the following change:
protected function upload_file($state_info)
{
  if(isset($state_info->field_name) && isset($this->upload_fields[$state_info->field_name]))
  {
   $upload_info = $this->upload_fields[$state_info->field_name];
  
			// Set useful variables
   $upload_path = $this->upload_fields[$state_info->field_name]->upload_path . '/';
   $file_type = $this->upload_fields[$state_info->field_name]->file_type;
   $thumbnail = $this->upload_fields[$state_info->field_name]->thumbnail;
   $upload_file = explode('.', $state_info->file_name);
   $upload_file_ext = end($upload_file);
   $upload_file_name = substr($state_info->file_name, 0, ((strlen($upload_file_ext)+1)*-1));
   $upload_file_name_orig = $upload_file_name;
  
  
   if($file_type != NULL)
   {
	$file_type_array = explode('|',$file_type);
	if(!in_array($upload_file_ext,$file_type_array))
	{
	 //return FALSE;
	}
   }
   // Create upload path folder if it doesn't already exist
   if (!is_dir($upload_path)) {
	mkdir($upload_path);
   }
   $i = 1;
   while(file_exists($upload_path . $upload_file_name . '.' . $upload_file_ext)){
	// Our file exists. Rename.
	$upload_file_name = $upload_file_name_orig . '_' . $i;
	$state_info->file_name = $upload_file_name . '.' . $upload_file_ext;
	$i++;
   }
   $input = fopen("php://input", "r");
		 $temp = tmpfile();
		 $realSize = stream_copy_to_stream($input, $temp);
		 fclose($input);
		
		 $target = fopen("{$upload_info->upload_path}/{$state_info->file_name}", "w");
		 fseek($temp, 0, SEEK_SET);
		 stream_copy_to_stream($temp, $target);
		 fclose($target);
		
			if($thumbnail != NULL)
   {
	// Create Thumbnail folder if it doesn't already exist
	if (!is_dir($upload_path . "Thumbnail")) {
	 mkdir($upload_path . "Thumbnail");
	}
	// File Uploaded
	$thumbnail_array = explode('|',$thumbnail);
	$config = array (
	'source_image'  => $upload_path . $state_info->file_name,
	'new_image'   => $upload_path . "Thumbnail/" . $state_info->file_name,
	'maintain_ration' => FALSE,
	'width'	=> $thumbnail_array[0],
	'height'   => $thumbnail_array[1]
	);
	// Generate the Thumbnail If Is Image
	$ci = &get_instance();
	$ci->load->library('image_lib', $config);
	if ( ! $ci->image_lib->resize())
	{
	 //return FALSE;
	}
   }
		 return (object)array('file_name' => $state_info->file_name);
  }
  else
  {
   //return false;
  }
}

function delete_file find, and the following change:
protected function delete_file($state_info)
{
  if(isset($state_info->field_name) && isset($this->upload_fields[$state_info->field_name]))
  {
   $upload_info = $this->upload_fields[$state_info->field_name];
  
   if(file_exists("{$upload_info->upload_path}/{$state_info->file_name}"))
   {
	if( unlink("{$upload_info->upload_path}/{$state_info->file_name}") )
	{
	 $this->basic_model->db_file_delete($state_info->field_name, $state_info->file_name);
	 if(file_exists("{$upload_info->upload_path}/Thumbnail/{$state_info->file_name}"))
	 {
	  unlink("{$upload_info->upload_path}/Thumbnail/{$state_info->file_name}");
	 }
	 return true;
	}
	else
	{
	 return false;
	}
   }
   else
   {
	$this->basic_model->db_file_delete($state_info->field_name, $state_info->file_name);
	return true;
   }
  }
  else
  {
   return false;
  }
}

function set_field_upload find, and the following change:
/**
*
* Enter description here ...
* @param string $field_name
* @param string $upload_path
* @param array $File_type
*/
public function set_field_upload($field_name, $upload_path , $file_type = NULL , $thumbnail = NULL)
{
$upload_path = substr($upload_path,-1,1) == '/' ? substr($upload_path,0,-1) : $upload_path;
$this->upload_fields[$field_name] = (object)array( 'field_name' => $field_name , 'upload_path' => $upload_path , 'file_type' => $file_type , 'thumbnail' => $thumbnail);
}




Finished editing the library. Now consider the following example:
function news()
{
try{
$crud = new grocery_CRUD();
$crud->set_table('news');

//$crud->set_field_upload('Fild Name','Path Of Upload' [, 'File Type Validate , 'Thumbnail Width|Thumbnail Height']);

// Upload Without Validate And Thumbnail
$crud->set_field_upload('mp3','songs');

// Upload Without Thumbnail
$crud->set_field_upload('mp3','songs' , 'mp3');
$crud->set_field_upload('poster','images/songs' , 'jpg|jpeg|gif|png');

// Upload With Validate And Thumbnail
$crud->set_field_upload('picture','images/news' , 'jpg|jpeg|gif|png' , '25|25');
$output = $crud->render();
$this->_example_output($output);
}catch(Exception $e){
show_error($e->getMessage().' --- '.$e->getTraceAsString());
}
}


Which is very useful for me
I hope you will also be useful for
...................................................................

M sorry for my poor English
---------------------------------------------------------------------------------------------------

Changes in the code:
I added a few lines of code
Some friends had a problem with the product thumbnail and thumbnail folders themselves did not know who should build the project.
I added the code to the destination folder and auto-thumbnailing not need to build it manually.

// Create upload path folder if it doesn't already exist
if (!is_dir($upload_path)){
mkdir($upload_path);
}
// Create Thumbnail folder if it doesn't already exist
if (!is_dir($upload_path . "Thumbnail")) {
mkdir($upload_path . "Thumbnail");
}

Admin please add this code in the next version of the library
Thanks Dear Admin