本文整理汇总了PHP中fix_filename函数的典型用法代码示例。如果您正苦于以下问题:PHP fix_filename函数的具体用法?PHP fix_filename怎么用?PHP fix_filename使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了fix_filename函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: fix_dirname
if ($path == $current_path) {
$cycle = false;
}
if (file_exists($path . 'config.php')) {
require_once $path . 'config.php';
$cycle = false;
}
$path = fix_dirname($path) . '/';
}
if (!empty($_FILES)) {
$info = pathinfo($_FILES['file']['name']);
if (isset($info['extension']) && in_array(fix_strtolower($info['extension']), $ext)) {
$tempFile = $_FILES['file']['tmp_name'];
$targetPath = $storeFolder;
$targetPathThumb = $storeFolderThumb;
$_FILES['file']['name'] = fix_filename($_FILES['file']['name'], $transliteration);
$file_name_splitted = explode('.', $_FILES['file']['name']);
array_pop($file_name_splitted);
$_FILES['file']['name'] = implode('-', $file_name_splitted) . '.' . $info['extension'];
if (file_exists($targetPath . $_FILES['file']['name'])) {
$i = 1;
$info = pathinfo($_FILES['file']['name']);
while (file_exists($targetPath . $info['filename'] . '_' . $i . '.' . $info['extension'])) {
$i++;
}
$_FILES['file']['name'] = $info['filename'] . '_' . $i . '.' . $info['extension'];
}
$targetFile = $targetPath . $_FILES['file']['name'];
$targetFileThumb = $targetPathThumb . $_FILES['file']['name'];
if (in_array(fix_strtolower($info['extension']), $ext_img) && @getimagesize($tempFile) != false) {
$is_img = true;
示例2: fix_dirname
if ($path == $current_path) {
$cycle = FALSE;
}
if (file_exists($path . "config.php")) {
require_once $path . "config.php";
$cycle = FALSE;
}
$path = fix_dirname($path) . '/';
}
if (!empty($_FILES)) {
$info = pathinfo($_FILES['file']['name']);
if (in_array(fix_strtolower($info['extension']), $ext)) {
$tempFile = $_FILES['file']['tmp_name'];
$targetPath = $storeFolder;
$targetPathThumb = $storeFolderThumb;
$_FILES['file']['name'] = fix_filename($_FILES['file']['name'], $transliteration, $convert_spaces, $replace_with);
// Gen. new file name if exists
if (file_exists($targetPath . $_FILES['file']['name'])) {
$i = 1;
$info = pathinfo($_FILES['file']['name']);
// append number
while (file_exists($targetPath . $info['filename'] . "_" . $i . "." . $info['extension'])) {
$i++;
}
$_FILES['file']['name'] = $info['filename'] . "_" . $i . "." . $info['extension'];
}
$targetFile = $targetPath . $_FILES['file']['name'];
$targetFileThumb = $targetPathThumb . $_FILES['file']['name'];
// check if image (and supported)
if (in_array(fix_strtolower($info['extension']), $ext_img)) {
$is_img = TRUE;
示例3: substr_replace
$paths .= "/";
}
$base_dir = $paths . substr_replace($info['dirname'] . "/", '', 0, strlen($current_path));
if (file_exists($base_dir . $fixed_image_creation_name_to_prepend[$k] . $info['filename'] . $fixed_image_creation_to_append[$k] . "." . $info['extension'])) {
rename_file($base_dir . $fixed_image_creation_name_to_prepend[$k] . $info['filename'] . $fixed_image_creation_to_append[$k] . "." . $info['extension'], $fixed_image_creation_name_to_prepend[$k] . $name . $fixed_image_creation_to_append[$k], $transliteration);
}
}
}
} else {
die(lang_Empty_name);
}
}
break;
case 'duplicate_file':
if ($duplicate_files) {
$name = fix_filename($name, $transliteration);
if (!empty($name)) {
if (!duplicate_file($path, $name)) {
die(lang_Rename_existing_file);
}
duplicate_file($path_thumb, $name);
if ($fixed_image_creation) {
$info = pathinfo($path);
foreach ($fixed_path_from_filemanager as $k => $paths) {
if ($paths != "" && $paths[strlen($paths) - 1] != "/") {
$paths .= "/";
}
$base_dir = $paths . substr_replace($info['dirname'] . "/", '', 0, strlen($current_path));
if (file_exists($base_dir . $fixed_image_creation_name_to_prepend[$k] . $info['filename'] . $fixed_image_creation_to_append[$k] . "." . $info['extension'])) {
duplicate_file($base_dir . $fixed_image_creation_name_to_prepend[$k] . $info['filename'] . $fixed_image_creation_to_append[$k] . "." . $info['extension'], $fixed_image_creation_name_to_prepend[$k] . $name . $fixed_image_creation_to_append[$k]);
}
示例4: fix_path
function fix_path($path, $transliteration, $convert_spaces = false, $replace_with = "_")
{
$info = pathinfo($path);
$tmp_path = $info['dirname'];
$str = strtolower(fix_filename($info['filename'], $transliteration, $convert_spaces, $replace_with));
if ($tmp_path != "") {
return $tmp_path . DIRECTORY_SEPARATOR . $str;
} else {
return $str;
}
}
示例5: fix_filename
if ($file != fix_filename($file, $transliteration)) {
$file1 = fix_filename($file, $transliteration);
$file_path1 = $current_path . $rfm_subfolder . $subdir . $file1;
if (file_exists($file_path1)) {
$i = 1;
$info = pathinfo($file1);
while (file_exists($current_path . $rfm_subfolder . $subdir . $info['filename'] . ".[" . $i . "]." . $info['extension'])) {
$i++;
}
$file1 = $info['filename'] . ".[" . $i . "]." . $info['extension'];
$file_path1 = $current_path . $rfm_subfolder . $subdir . $file1;
}
$filename = substr($file1, 0, '-' . (strlen($file_array['extension']) + 1));
rename_file($file_path, fix_filename($filename, $transliteration), $transliteration);
$file = $file1;
$file_array['extension'] = fix_filename($file_array['extension'], $transliteration);
$file_path = $file_path1;
}
$is_img = false;
$is_video = false;
$is_audio = false;
$show_original = false;
$show_original_mini = false;
$mini_src = "";
$src_thumb = "";
$extension_lower = fix_strtolower($file_array['extension']);
if (in_array($extension_lower, $ext_img)) {
$src = $base_url . $cur_dir . rawurlencode($file);
$mini_src = $src_thumb = $thumbs_path . $subdir . $file;
//add in thumbs folder if not exist
if (!file_exists($src_thumb)) {
示例6: fix_filename
if ($file != fix_filename($file)) {
$file1 = fix_filename($file);
$file_path1 = $current_path . $subfolder . $subdir . $file1;
if (file_exists($file_path1)) {
$i = 1;
$info = pathinfo($file1);
while (file_exists($current_path . $subfolder . $subdir . $info['filename'] . ".[" . $i . "]." . $info['extension'])) {
$i++;
}
$file1 = $info['filename'] . ".[" . $i . "]." . $info['extension'];
$file_path1 = $current_path . $subfolder . $subdir . $file1;
}
$filename = substr($file1, 0, '-' . (strlen($file_array['extension']) + 1));
rename_file($file_path, fix_filename($filename));
$file = $file1;
$file_array['extension'] = fix_filename($file_array['extension']);
$file_path = $file_path1;
}
$is_img = false;
$is_video = false;
$is_audio = false;
$show_original = false;
$show_original_mini = false;
$mini_src = "";
$src_thumb = "";
$extension_lower = mb_strtolower($file_array['extension']);
if (in_array($extension_lower, $ext_img)) {
$src = $base_url . $cur_dir . $file;
$mini_src = $src_thumb = $thumbs_path . $subdir . $file;
//add in thumbs folder if not exist
if (!file_exists($src_thumb)) {
示例7: fix_dirname
$cycle = FALSE;
}
$path = fix_dirname($path) . '/';
}
if (!empty($_FILES)) {
$info = pathinfo($_FILES['file']['name']);
$mime_type = get_file_mime_type($_FILES['file']['tmp_name']);
$extension = get_extension_from_mime($mime_type);
if ($extension === '' || $extension == 'so') {
$extension = $info['extension'];
}
if (in_array(fix_strtolower($extension), $ext)) {
$tempFile = $_FILES['file']['tmp_name'];
$targetPath = $storeFolder;
$targetPathThumb = $storeFolderThumb;
$_FILES['file']['name'] = fix_filename($info['filename'] . "." . $extension, $transliteration, $convert_spaces, $replace_with);
// LowerCase
if ($lower_case) {
$_FILES['file']['name'] = fix_strtolower($_FILES['file']['name']);
}
// Gen. new file name if exists
if (file_exists($targetPath . $_FILES['file']['name'])) {
$i = 1;
$info = pathinfo($_FILES['file']['name']);
// append number
while (file_exists($targetPath . $info['filename'] . "_" . $i . "." . $extension)) {
$i++;
}
$_FILES['file']['name'] = $info['filename'] . "_" . $i . "." . $extension;
}
$targetFile = $targetPath . $_FILES['file']['name'];
示例8: strpos
if (isset($_GET['descending'])) {
$_SESSION['RF']["descending"] = $_GET['descending'] === "TRUE";
}
break;
case 'image_size':
// not used
$pos = strpos($_POST['path'], $upload_dir);
if ($pos !== false) {
$info = getimagesize(substr_replace($_POST['path'], $current_path, $pos, strlen($upload_dir)));
response($info)->send();
exit;
}
break;
case 'save_img':
$info = pathinfo($_POST['name']);
if (strpos($_POST['path'], '/') === 0 || strpos($_POST['path'], '../') !== false || strpos($_POST['path'], './') === 0 || strpos($_POST['url'], 'http://s3.amazonaws.com/feather') !== 0 && strpos($_POST['url'], 'https://s3.amazonaws.com/feather') !== 0 || $_POST['name'] != fix_filename($_POST['name'], $transliteration, $convert_spaces, $replace_with) || !in_array(strtolower($info['extension']), array('jpg', 'jpeg', 'png'))) {
response('wrong data', 400)->send();
exit;
}
$image_data = file_get_contents($_POST['url']);
if ($image_data === false) {
response(trans('Aviary_No_Save'), 400)->send();
exit;
}
require_once 'include/php_image_magician.php';
$magicianObj = new imageLib($_POST['url']);
$magicianObj->saveImage($current_path . $_POST['path'] . $_POST['name']);
create_img($current_path . $_POST['path'] . $_POST['name'], $thumbs_base_path . $_POST['path'] . $_POST['name'], 122, 91);
// TODO something with this function cause its blowing my mind
new_thumbnails_creation($current_path . $_POST['path'], $current_path . $_POST['path'] . $_POST['name'], $_POST['name'], $current_path, $relative_image_creation, $relative_path_from_current_pos, $relative_image_creation_name_to_prepend, $relative_image_creation_name_to_append, $relative_image_creation_width, $relative_image_creation_height, $relative_image_creation_option, $fixed_image_creation, $fixed_path_from_filemanager, $fixed_image_creation_name_to_prepend, $fixed_image_creation_to_append, $fixed_image_creation_width, $fixed_image_creation_height, $fixed_image_creation_option);
break;
示例9: fix_filename
} else {
?>
<a class="preview disabled"><i class="icon-eye-open icon-white"></i></a>
<?php
}
?>
<a
onclick="edit(<?php
echo $voila_id;
?>
, '<?php
echo $file_path;
?>
',
'<?php
echo fix_filename($filename, $transliteration);
?>
',
'<?php
echo $transliteration;
?>
')" id="renaming" rel="<?php
echo $voila_id;
?>
" data-toggle="modal" href="#form-content" class="tip-left edit-button rename-file-paths <?php
if ($rename_files && !$file_prevent_rename) {
echo "rename-file1";
}
?>
" title="<?php
echo trans('Rename');
示例10: fix_dirname
if ($path == $current_path) {
$cycle = FALSE;
}
if (file_exists($path . "config.php")) {
require_once $path . "config.php";
$cycle = FALSE;
}
$path = fix_dirname($path) . '/';
}
if (!empty($_FILES)) {
$info = pathinfo($_FILES['file']['name']);
if (in_array(fix_strtolower($info['extension']), $ext)) {
$tempFile = $_FILES['file']['tmp_name'];
$targetPath = $storeFolder;
$targetPathThumb = $storeFolderThumb;
$_FILES['file']['name'] = fix_filename($_FILES['file']['name'], $transliteration, $convert_spaces);
// Gen. new file name if exists
if (file_exists($targetPath . $_FILES['file']['name'])) {
$i = 1;
$info = pathinfo($_FILES['file']['name']);
// append number
while (file_exists($targetPath . $info['filename'] . "_" . $i . "." . $info['extension'])) {
$i++;
}
$_FILES['file']['name'] = $info['filename'] . "_" . $i . "." . $info['extension'];
}
$targetFile = $targetPath . $_FILES['file']['name'];
$targetFileThumb = $targetPathThumb . $_FILES['file']['name'];
// check if image (and supported)
if (in_array(fix_strtolower($info['extension']), $ext_img)) {
$is_img = TRUE;
示例11: substr_replace
$paths .= "/";
}
$base_dir = $paths . substr_replace($info['dirname'] . "/", '', 0, strlen($current_path));
if (file_exists($base_dir . $fixed_image_creation_name_to_prepend[$k] . $info['filename'] . $fixed_image_creation_to_append[$k] . "." . $info['extension'])) {
rename_file($base_dir . $fixed_image_creation_name_to_prepend[$k] . $info['filename'] . $fixed_image_creation_to_append[$k] . "." . $info['extension'], $fixed_image_creation_name_to_prepend[$k] . $name . $fixed_image_creation_to_append[$k], $transliteration);
}
}
}
} else {
die(lang_Empty_name);
}
}
break;
case 'duplicate_file':
if ($duplicate_files) {
$name = fix_filename($name, $transliteration, $convert_spaces);
if (!empty($name)) {
if (!duplicate_file($path, $name)) {
die(lang_Rename_existing_file);
}
duplicate_file($path_thumb, $name);
if ($fixed_image_creation) {
$info = pathinfo($path);
foreach ($fixed_path_from_filemanager as $k => $paths) {
if ($paths != "" && $paths[strlen($paths) - 1] != "/") {
$paths .= "/";
}
$base_dir = $paths . substr_replace($info['dirname'] . "/", '', 0, strlen($current_path));
if (file_exists($base_dir . $fixed_image_creation_name_to_prepend[$k] . $info['filename'] . $fixed_image_creation_to_append[$k] . "." . $info['extension'])) {
duplicate_file($base_dir . $fixed_image_creation_name_to_prepend[$k] . $info['filename'] . $fixed_image_creation_to_append[$k] . "." . $info['extension'], $fixed_image_creation_name_to_prepend[$k] . $name . $fixed_image_creation_to_append[$k]);
}
示例12: fix_path
function fix_path($path, $transliteration)
{
$path = fixName($path);
$info = pathinfo($path);
if (($s = strrpos($path, '/')) !== false) {
$s++;
}
if (($e = strrpos($path, '.') - $s) !== strlen($info['filename'])) {
$info['filename'] = substr($path, $s, $e);
$info['basename'] = substr($path, $s);
}
$tmp_path = $info['dirname'] . DIRECTORY_SEPARATOR . $info['basename'];
$str = fix_filename($info['filename'], $transliteration);
if ($tmp_path != "") {
return $tmp_path . DIRECTORY_SEPARATOR . $str;
} else {
return $str;
}
}
示例13: fix_path
function fix_path($path, $transliteration, $convert_spaces = false)
{
echo 'aaaaaaaaaaaaa';
die;
$info = pathinfo($path);
$tmp_path = $info['dirname'];
$str = fix_filename($info['filename'], $transliteration, $convert_spaces);
if ($tmp_path != "") {
return $tmp_path . DIRECTORY_SEPARATOR . $str;
} else {
return $str;
}
}
示例14: fix_dirname
if ($path == $current_path) {
$cycle = false;
}
if (file_exists($path . "config.php")) {
require_once $path . "config.php";
$cycle = false;
}
$path = fix_dirname($path) . '/';
}
if (!empty($_FILES)) {
$info = pathinfo($_FILES['file']['name']);
if (in_array(fix_strtolower($info['extension']), $ext)) {
$tempFile = $_FILES['file']['tmp_name'];
$targetPath = $storeFolder;
$targetPathThumb = $storeFolderThumb;
$_FILES['file']['name'] = fix_filename($_FILES['file']['name']);
if (file_exists($targetPath . $_FILES['file']['name'])) {
$i = 1;
$info = pathinfo($_FILES['file']['name']);
while (file_exists($targetPath . $info['filename'] . ".[" . $i . "]." . $info['extension'])) {
$i++;
}
$_FILES['file']['name'] = $info['filename'] . ".[" . $i . "]." . $info['extension'];
}
$targetFile = $targetPath . $_FILES['file']['name'];
$targetFileThumb = $targetPathThumb . $_FILES['file']['name'];
if (in_array(fix_strtolower($info['extension']), $ext_img)) {
$is_img = true;
} else {
$is_img = false;
}
示例15: strpos
$_SESSION['descending'] = $_GET['descending'] === 'true';
}
break;
case 'image_size':
if (realpath(dirname(_PS_ROOT_DIR_ . $_POST['path'])) != realpath(_PS_ROOT_DIR_ . $upload_dir)) {
die;
}
$pos = strpos($_POST['path'], $upload_dir);
if ($pos !== false) {
$info = getimagesize(substr_replace($_POST['path'], $current_path, $pos, strlen($upload_dir)));
echo json_encode($info);
}
break;
case 'save_img':
$info = pathinfo($_POST['name']);
if (strpos($_POST['path'], '/') === 0 || strpos($_POST['path'], '../') !== false || strpos($_POST['path'], './') === 0 || strpos($_POST['url'], 'http://featherfiles.aviary.com/') !== 0 || $_POST['name'] != fix_filename($_POST['name'], $transliteration) || !in_array(strtolower($info['extension']), array('jpg', 'jpeg', 'png'))) {
die('wrong data');
}
$image_data = get_file_by_url($_POST['url']);
if ($image_data === false) {
die('file could not be loaded');
}
$put_contents_path = $current_path;
if (isset($_POST['path'])) {
$put_contents_path .= str_replace("", "", $_POST['path']);
}
if (isset($_POST['name'])) {
$put_contents_path .= str_replace("", "", $_POST['name']);
}
file_put_contents($put_contents_path, $image_data);
//new thumb creation