Skip to content

Instantly share code, notes, and snippets.

@azinkey
azinkey / gist:5195345
Last active December 15, 2015 03:38
A simple way to set a frame with help of "Imagick"
<?php
/**
* Easiest way to set a frame (Image Magick Required)
*
* @name Image Composition(Set Frame)
* @author AZinkey
*/
/********* Set Your World *************/
// define directory seprator
@azinkey
azinkey / gist:5236394
Last active December 15, 2015 09:09
PHP Imagick Masking & Shape Overlay
<?php
/********* Configure File *************/
//// Set image name
$fname = 'a';
$artFile = $folder . $fname.'.jpg';
$maskFile = $folder . 'c.png';
$frameFile = $folder . 'frame.png';
$cameraFile = $folder . 'c.png';
$art = new Imagick($artFile);
@azinkey
azinkey / gist:6634046
Last active January 11, 2018 12:05
Crop Image as shape with alpha transparency using PHP GD
<?php
/**
* PHP GD use one image to mask another image including transparency
* @param (GD)resource $picture orignal reference image
* @param (GD)resource $mask shape black/white image
* @return (GD)resource output shape image resource
*
* http://stackoverflow.com/questions/7203160/
*
<form method="post" action="https://sandbox.paypal.com/cgi-bin/webscr">
<input type="hidden" value="utf-8" name="charset">
<input type="hidden" value="_cart" name="cmd">
<input type="hidden" value="1" name="upload">
<input type="hidden" value="azinkey-facilitator@gmail.com" name="business">
<input type="hidden" value="USD" name="currency_code">
@azinkey
azinkey / AWS backup.php
Last active January 10, 2017 09:15
Generate website backup zip and upload to AWS s3 Cloud
<?php
use Aws\S3\S3Client;
use Aws\S3\Exception\S3Exception;
/* creates a compressed zip file */
error_reporting(E_ALL);
ini_set('display_errors', '1');
ini_set('max_execution_time', 0);
//require_once './sql_backup.php';
@azinkey
azinkey / indent.php
Created March 7, 2017 05:09
Indent json
function indent($json) {
$result = '';
$pos = 0;
$strLen = strlen($json);
$indentStr = ' ';
$newLine = "\n";
$prevChar = '';
$outOfQuotes = true;
@azinkey
azinkey / .htaccess Quick Intro & Examples
Created September 21, 2018 13:21
A quick intorduction of .htaccess
What is .htaccess?
The .htaccess file is a configuration file that affects how a webserver responds to various requests.
------------------------
Why is it called .htaccess?
(Hyper Text + Access) These files were first used to control user access on a per-directory basis.
@azinkey
azinkey / Child Categories.php
Created October 31, 2018 13:44
Parent Child Flat array to Tree/List
<?php
$a = '[{"id":"21","name":"Clothes","parent":"52"},{"id":"28","name":"category-D","parent":"21"},{"id":"29","name":"Category-E","parent":"28"},{"id":"30","name":"Category-F","parent":"29"},{"id":"31","name":"category-G","parent":"30"},{"id":"48","name":"category-Y","parent":"0"},{"id":"51","name":"category name","parent":"48"},{"id":"52","name":"categoryAAA","parent":"0"},{"id":"53","name":"category","parent":"52"},{"id":"54","name":"Clothes","parent":"0"},{"id":"55","name":"Cloth","parent":"171"},{"id":"56","name":"Headphone","parent":"1455555"},{"id":"57","name":"Mobile","parent":"2147483647"},{"id":"59","name":"category","parent":"21"},{"id":"61","name":"Shirt","parent":"59"},{"id":"62","name":"Shoes","parent":"0"},{"id":"63","name":"Smartphones","parent":"0"},{"id":"64","name":"Test Category Test","parent":"0"},{"id":"65","name":"Smartphones","parent":"21"},{"id":"66","name":"Charger","parent":"21"},{"id":"71","name":"CheckTime","parent":"0"},{"id":"72","name":"category","parent":"0"},{"id":"
<?php
$placeid = 'ChIJVxtZ-6W2bTkRmcdDL6lOaZg'; //https://developers.google.com/places/place-id
$key = 'AIzaSyBbab2cj0xeIEzgzgyMat-mA-aVAtPVn6Q';
$servername = "localhost";
$username = "root";
$password = "kadam@123";
$fields = array(
ob_clean();
header('Content-type: application/pdf');
header('Content-Disposition: inline; filename="filename_here.pdf"');
header('Content-Transfer-Encoding: binary');
echo base64_decode($content);
ob_end_clean();