This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<input type='file' name="image" onchange="preview(this);" multiple="multiple" /> | |
<div id='previewImg'></div> | |
<script> | |
window.preview = function (input) { | |
if (input.files && input.files[0]) { | |
$(input.files).each(function () { | |
var reader = new FileReader(); | |
reader.readAsDataURL(this); | |
reader.onload = function (e) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$tempFile = $_SERVER["DOCUMENT_ROOT"]. 'images/image.jpeg'; | |
$im = @imagecreatefromjpeg($tempFile); | |
if(empty($im)){ | |
return false; | |
}else{ | |
return true; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$data = '/*Add you base64 encode data*/'; | |
$encoded_string = base64_encode($data); | |
if(!empty($encoded_string)){ | |
$imgdata = base64_decode($encoded_string); | |
$f = finfo_open(); | |
$mime_type = finfo_buffer($f, $imgdata, FILEINFO_MIME_TYPE); | |
$img = 'data:'.$mime_type.';base64,'.$encoded_string; | |
$fileType = ''; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$buffer ='<xml><item><id>1</id><name>Test</name></item></xml>'; | |
$xml = new SimpleXMLElement($buffer); | |
$data = json_encode($xml, JSON_PRETTY_PRINT); | |
$data2 = json_decode($data); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<textarea class="form-control category_content" name="category_content[1]" id="desc_1" required> | |
<textarea class="form-control category_content" name="category_content[2]" id="desc_2" required> | |
<textarea class="form-control category_content" name="category_content[3]" id="desc_3" required> | |
$('.category_content').each(function(e){ | |
CKEDITOR.replace( $(this).attr('id'), { | |
height: '400px', | |
toolbar: [ | |
{ name: 'clipboard', groups: [ 'clipboard', 'undo' ], items: [ 'Cut', 'Copy', 'Paste', 'PasteText', 'PasteFromWord', '-', 'Undo', 'Redo' ] }, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$error= ' Test log file'; | |
$myfile = file_put_contents(get_template_directory() . '/logs.php', $error.PHP_EOL , FILE_APPEND | LOCK_EX); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Snippet Random Numbers</title> | |
</head> | |
<body> | |
<div class="container"> | |
<div class="row"> | |
<a href="javascript:;" data-value='5'>Get Random number (5)</a><br> | |
<a href="javascript:;" data-value='10'>Get Random number (10)</a><br> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Run this command to stop xampp: | |
sudo /opt/lampp/lampp stop | |
Open /opt/lampp/etc/httpd.conf | |
Change your_folder to the folder you wanna use | |
DocumentRoot "/home/username/your_folder" | |
<Directory "/home/username/your_folder"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public function sendmail($maildata, $to, $subject, $attachments = []) | |
{ | |
require_once(APPPATH.'third_party/PHPMailer/PHPMailerAutoload.php'); | |
//Create a new PHPMailer instance | |
$mail = new PHPMailer; | |
$mail->SMTPOptions = array( | |
'ssl' => array( | |
'verify_peer' => false, | |
'verify_peer_name' => false, |
OlderNewer