本文整理汇总了PHP中UniteFunctionsWPRev::import_media_img方法的典型用法代码示例。如果您正苦于以下问题:PHP UniteFunctionsWPRev::import_media_img方法的具体用法?PHP UniteFunctionsWPRev::import_media_img怎么用?PHP UniteFunctionsWPRev::import_media_img使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UniteFunctionsWPRev
的用法示例。
在下文中一共展示了UniteFunctionsWPRev::import_media_img方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: rev_uploader
private function rev_uploader()
{
$key = Tools::getValue('security_key');
if (empty($key) || Tools::encrypt(GlobalsRevSlider::MODULE_NAME) != $key) {
echo json_encode(array('error_on' => 1, 'error_details' => 'Security Error'));
die;
}
$targetFolder = ABSPATH . '/uploads/';
$randnum = rand(00, 9999999);
$sds_time = time();
$NewFileName = $randnum . '-' . $sds_time;
//$verifyToken = md5('unique_salt' . $_POST['timestamp']);
if (!empty($_FILES)) {
$tempFile = $_FILES['Filedata']['tmp_name'];
//$targetPath = $_SERVER['DOCUMENT_ROOT'] . $targetFolder;
$targetPath = $targetFolder;
//$targetFile = rtrim($targetPath,'/') . '/' . $_FILES['Filedata']['name'];
// Validate the file type
$fileTypes = array('jpg', 'jpeg', 'gif', 'png');
// File extensions
$fileParts = pathinfo($_FILES['Filedata']['name']);
if (in_array($fileParts['extension'], $fileTypes)) {
// $worked = UniteFunctionsWPRev::import_media_img($tempFile, $targetPath, $randnum.$_FILES['Filedata']['name']);
$worked = UniteFunctionsWPRev::import_media_img($tempFile, $targetPath, $NewFileName . '.' . $fileParts['extension']);
if (!empty($worked)) {
echo '1';
}
} else {
echo '0';
}
}
}
示例2: RevSliderAdmin
require_once ABSPATH . "/revslider_admin.php";
$admin = new RevSliderAdmin(ABSPATH, false);
$key = Tools::getValue('security_key');
if (empty($key) || Tools::encrypt(GlobalsRevSlider::MODULE_NAME) != $key) {
echo json_encode(array('error_on' => 1, 'error_details' => 'Security Error'));
die;
}
// Define a destination
// $targetFolder = _PS_MODULE_DIR_.'revsliderprestashop/uploads'; // Relative to the root
$targetFolder = ABSPATH . '/uploads/';
$randnum = rand(00, 9999999);
//$verifyToken = md5('unique_salt' . $_POST['timestamp']);
if (!empty($_FILES)) {
$tempFile = $_FILES['Filedata']['tmp_name'];
//$targetPath = $_SERVER['DOCUMENT_ROOT'] . $targetFolder;
$targetPath = $targetFolder;
//$targetFile = rtrim($targetPath,'/') . '/' . $_FILES['Filedata']['name'];
// Validate the file type
$fileTypes = array('jpg', 'jpeg', 'gif', 'png');
// File extensions
$fileParts = pathinfo($_FILES['Filedata']['name']);
if (in_array($fileParts['extension'], $fileTypes)) {
$worked = UniteFunctionsWPRev::import_media_img($tempFile, $targetPath, $randnum . $_FILES['Filedata']['name']);
if (!empty($worked)) {
echo '1';
}
} else {
echo 'Invalid file type.';
}
die;
}
示例3: rand
$is_img = false;
}
if ($is_img) {
/*revolution odl system*/
$targetFolder = ABSPATH . '/uploads/';
$randnum = rand(00, 9999999);
$sds_time = time();
$NewFileName = $randnum . '-' . $sds_time;
$tempFile = $_FILES['file']['tmp_name'];
$targetPath = $targetFolder;
// Validate the file type
$fileTypes = array('jpg', 'jpeg', 'gif', 'png');
// File extensions
$fileParts = pathinfo($_FILES['file']['name']);
if (in_array($fileParts['extension'], $fileTypes)) {
$worked = UniteFunctionsWPRev::import_media_img($tempFile, $targetPath, $NewFileName . '.' . $fileParts['extension']);
if (!empty($worked)) {
echo '1';
}
} else {
echo '0';
}
}
} else {
header('HTTP/1.1 406 file not permitted', true, 406);
exit;
}
} else {
header('HTTP/1.1 405 Bad Request', true, 405);
exit;
}