Friday, 8 June 2018

Import Large size of databse facing errors ERROR 1118 (42000) , ERROR 2006 (HY000) & ERROR 1118 (42000)

Your  path xampp\mysql\bin\my.ini 

# ERROR 2006 (HY000) at line 1995: MySQL server has gone away

max_allowed_packet = 256M

# ERROR 1118 (42000) at line 1995: The size of BLOB/TEXT data inserted in one transaction is greater than 10% of redo log size. Increase the redo log size using innodb_log_file_size.

innodb_log_file_size = 256M

# ERROR 1118 (42000) at line 1807: Row size too large (> 8126). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline

max_allowed_packet=1G
innodb_file_per_table=1
innodb_file_format=Barracuda

Once values changed restart you xampp & Mysql servers

Thursday, 31 May 2018

Image Resize and save by using GD function and Percentage based

<?php
$filename = 'test.jpg';
$percent = .5;
list($width, $height) = getimagesize($filename);
$newwidth = $width * $percent;
$newheight = $height * $percent;
$thumb = imagecreatetruecolor($newwidth, $newheight);
$source = imagecreatefromjpeg($filename);
imagecopyresized($thumb, $source, 0, 0, 0, 0, $newwidth, $newheight, $width, $height);
$ourFileName = "newtest.jpg";
imagejpeg($thumb, $ourFileName);
imagedestroy($thumb);
?>

Wednesday, 23 May 2018

How to create custom log in cakephp?

1. Add bootstrap for this in below

CakeLog::config('customlog', array('engine' => 'File'));

2. Create log message in custom logfile

CakeLog::write('customlog', 'myArray');

Check now you log directory once created