sudo du -x -h / | sort -h | tail -40
Shopify, Shopify Apps, Magento, WordPress, Codeigniter, Joomla, Big Commerce | PHP
Monday, 24 April 2017
/dev/xvda1 Full Inodes 100% AWS Amazon server Ubuntu 14.04
sudo du -x -h / | sort -h | tail -40
Wednesday, 29 March 2017
How to install PHP, apache and mysql in ununtu 14.04
https://www.howtoforge.com/ubuntu-lamp-server-with-apache2-php5-mysql-on-14.04-lts
https://www.digitalocean.com/community/tutorials/how-to-install-and-secure-phpmyadmin-on-ubuntu-12-04
Enable .htaccess
sudo a2enmod rewrite
sudo service apache2 restart
sudo nano /etc/apache2/sites-available/000-default.conf
<Directory "/var/www/html">
AllowOverride All
</Directory>
sudo service apache2 restart
Monday, 23 January 2017
How to import Big SQL file usign PHP with shell command into hosting server
<?php
error_reporting(E_ALL ^ E_NOTICE);
ini_set('display_errors', 1);
ini_set('memory_limit', '512M');
$dbinfo = array(
"host" => 'localhost',
"user" => 'magentom_jaydip',
"pass" => 'rmO22RQ%UbW0',
"dbname" => 'magentom_jaydip'
);
// Database Config
$sqlhost = $dbinfo["host"];
$dbuser = $dbinfo["user"];
$dbpassword = $dbinfo["pass"];
$dbname = $dbinfo["dbname"];
// filename
$file = "mg_jaydip.sql";
shell_exec("mysql -u $dbuser --password='$dbpassword' --host='$sqlhost' $dbname < $file");
echo 'Finished!<br/>';
?>
error_reporting(E_ALL ^ E_NOTICE);
ini_set('display_errors', 1);
ini_set('memory_limit', '512M');
$dbinfo = array(
"host" => 'localhost',
"user" => 'magentom_jaydip',
"pass" => 'rmO22RQ%UbW0',
"dbname" => 'magentom_jaydip'
);
// Database Config
$sqlhost = $dbinfo["host"];
$dbuser = $dbinfo["user"];
$dbpassword = $dbinfo["pass"];
$dbname = $dbinfo["dbname"];
// filename
$file = "mg_jaydip.sql";
shell_exec("mysql -u $dbuser --password='$dbpassword' --host='$sqlhost' $dbname < $file");
echo 'Finished!<br/>';
?>
Wednesday, 18 January 2017
How to clone perticular / specific branch from bitbucket / github
git clone -b branchname https://url@bitbucket.org/jaydip/url.git
Monday, 26 December 2016
How can i do When Disk quota exceeded into Cpanel or WHM
The system failed to open the session file "var/cpanel/session/raw:***" because of an error : Disk quota exceeded at /usr/local/cpanel/Cpanel/session.pm line 268
- Use : Download winscp (https://winscp.net/eng/download.php)
- Install and connect your FTP account or WHM account then remove some files.
- Finish!!!
Thursday, 10 November 2016
Search with jQuery / Javascript
$('#artsearch').keyup(function(){
var searchtext = $('#artsearch').val();
if(searchtext.length >= 3){
$('#photoPreview .file-row').each(function(){
var $this = $(this);
var $text = $this.find('.arttitle .name').text();
var indexcount = $text.indexOf(searchtext);
if(indexcount > -1){
$this.show();
}else{
$this.hide();
}
});
}
if(searchtext.length == 0){
$('#photoPreview .file-row').show();
}
});
Saturday, 8 October 2016
How to upload products multiple images in codeigniter Gocart in admin panel
Open : gocart/views/admin/iframe/product_image_uploader.php
Update product_image_upload() function
Open : gocart/views/admin/product_form.php
Update : add_product_image(data) function
<?php include('header.php');?>Open : gocart/controllers/admin/products.php
<script type="text/javascript">
<?php if( $this->input->post('submit') ):?>
$(window).ready(function(){
$('#iframe_uploader', window.parent.document).height($('body').height()); });
<?php endif;?>
<?php if($file_name):?>
parent.add_product_image('<?php echo json_encode($file_name);?>');
<?php endif;?>
</script>
<?php if (!empty($error)): ?>
<div class="alert alert-error">
<a class="close" data-dismiss="alert">×</a>
<?php echo $error; ?>
</div>
<?php endif; ?>
<div class="row-fluid">
<div class="col-md-12">
<?php echo form_open_multipart($this->config->item('admin_folder') . '/products/product_image_upload', 'class="form-inline "'); ?>
<?php echo form_upload(array('name' => 'userfile[]', 'id' => 'userfile', 'class' => 'input-file', 'multiple'=>"true" )); ?>
<input class="btn" name="submit" type="submit" value="<?php echo lang('upload'); ?>" />
</form>
</div>
</div>
<?php include('footer.php');
Update product_image_upload() function
function product_image_upload() {
$data['file_name'] = false;
$data['error'] = false;
$config['allowed_types'] = 'gif|jpg|png';
//$config['max_size'] = $this->config->item('size_limit');
$config['upload_path'] = 'uploads/images/full';
$config['encrypt_name'] = true;
$config['remove_spaces'] = true;
$this->load->library('upload', $config);
$files = $_FILES;
$cpt = count($_FILES['userfile']['name']);
for($i=0; $i<$cpt; $i++)
{
$_FILES['userfile']['name']= $files['userfile']['name'][$i];
$_FILES['userfile']['type']= $files['userfile']['type'][$i];
$_FILES['userfile']['tmp_name']= $files['userfile']['tmp_name'][$i];
$_FILES['userfile']['error']= $files['userfile']['error'][$i];
$_FILES['userfile']['size']= $files['userfile']['size'][$i];
//$this->upload->initialize($this->set_upload_options());
if ($this->upload->do_upload()) {
$upload_data = $this->upload->data();
$this->load->library('image_lib');
/*
I find that ImageMagick is more efficient that GD2 but not everyone has it
if your server has ImageMagick then you can change out the line
$config['image_library'] = 'gd2';
with
$config['library_path'] = '/usr/bin/convert'; //make sure you use the correct path to ImageMagic
$config['image_library'] = 'ImageMagick';
*/
//this is the larger image
$config['image_library'] = 'gd2';
$config['source_image'] = 'uploads/images/full/' . $upload_data['file_name'];
$config['new_image'] = 'uploads/images/medium/' . $upload_data['file_name'];
$config['maintain_ratio'] = TRUE;
$config['width'] = 600;
$config['height'] = 500;
$this->image_lib->initialize($config);
$this->image_lib->resize();
$this->image_lib->clear();
//small image
$config['image_library'] = 'gd2';
$config['source_image'] = 'uploads/images/medium/' . $upload_data['file_name'];
$config['new_image'] = 'uploads/images/small/' . $upload_data['file_name'];
$config['maintain_ratio'] = TRUE;
$config['width'] = 235;
$config['height'] = 235;
$this->image_lib->initialize($config);
$this->image_lib->resize();
$this->image_lib->clear();
//cropped thumbnail
$config['image_library'] = 'gd2';
$config['source_image'] = 'uploads/images/small/' . $upload_data['file_name'];
$config['new_image'] = 'uploads/images/thumbnails/' . $upload_data['file_name'];
$config['maintain_ratio'] = TRUE;
$config['width'] = 150;
$config['height'] = 150;
$this->image_lib->initialize($config);
$this->image_lib->resize();
$this->image_lib->clear();
$data['file_name'][] = $upload_data['file_name'];
}
}
if ($this->upload->display_errors() != '') {
$data['error'] = $this->upload->display_errors();
}
$this->load->view($this->config->item('admin_folder') . '/iframe/product_image_uploader', $data);
}
Open : gocart/views/admin/product_form.php
Update : add_product_image(data) function
function add_product_image(data) {
var $images = $.parseJSON(data);
$.each($images, function(i, image) {
p = image.split('.');
var photo = '<?php add_image("' + p[0] + '", "' + p[0] + '.' + p[1] + '", '
', '
', '
', base_url('
uploads / images / thumbnails '));?>';
$('#gc_photos').append(photo);
$('#gc_photos').sortable('destroy');
photos_sortable();
});
}
Subscribe to:
Posts (Atom)