This file contains hidden or 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
/** | |
* With axios agent | |
*/ | |
axios({ | |
url: 'url', | |
method: 'POST', | |
responseType: 'blob' | |
}).then(res => { | |
const fileURL = URL.createObjectURL(res.data); | |
window.open(fileURL); |
This file contains hidden or 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
$png = 'image/path/filename.png'; | |
$img = imagecreatefrompng($png); | |
//find the size of the borders | |
$b_top = 0; | |
$b_btm = 0; | |
$b_lft = 0; | |
$b_rt = 0; | |
//top |
This file contains hidden or 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
$ch = curl_init(); | |
$options = [ | |
CURLOPT_RETURNTRANSFER => true, // return web page | |
CURLOPT_HEADER => false, // don't return headers | |
CURLOPT_FOLLOWLOCATION => true, // follow redirects | |
CURLOPT_MAXREDIRS => 10, // stop after 10 redirects | |
CURLOPT_ENCODING => "", // handle compressed | |
CURLOPT_USERAGENT => "test", // name of client | |
CURLOPT_AUTOREFERER => true, // set referrer on redirect |
This file contains hidden or 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
const env = (key, defaultValue = null) => { | |
const value = process.env[key] ?? defaultValue; | |
switch (String(value).toLowerCase()) { | |
case 'true' || '(true)': | |
return true; | |
case 'false' || '(false)': | |
return false; | |
case 'empty' || '(empty)': | |
return ''; | |
case 'null' || '(null)': |
OlderNewer