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
/* | |
* copy remote web file on local | |
* | |
* usage: | |
* require('urlToFile')('http://domain.tld/image.jpg', '/local/path/image.jpg', function() {console.log('success !');}, function(message) {console.log(message);}); | |
*/ | |
var http = require('http'); | |
var fs = require('fs'); |
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
function insertThumbnail($data, $postArr) { | |
if(!isset($postArr['ID'])) { | |
return $data; | |
} | |
$postId = $postArr['ID']; | |
$metaKey = 'you-post-meta-video-key'; // the custom meta key | |
// If video and video format | |
if(isset($postArr[$metaKey]) && ''!==$postArr[$metaKey] ) { |
NewerOlder