当前位置: 首页>>代码示例>>PHP>>正文


PHP create_img函数代码示例

本文整理汇总了PHP中create_img函数的典型用法代码示例。如果您正苦于以下问题:PHP create_img函数的具体用法?PHP create_img怎么用?PHP create_img使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了create_img函数的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: fix_strtolower

 }
 $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)) {
         try {
             if (!create_img($file_path, $src_thumb, 122, 91)) {
                 $src_thumb = $mini_src = "";
             } else {
                 new_thumbnails_creation($current_path . $rfm_subfolder . $subdir, $file_path, $file, $current_path, '', '', '', '', '', '', '', $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);
             }
         } catch (Exception $e) {
             $src_thumb = $mini_src = "";
         }
     }
     $is_img = true;
     //check if is smaller than thumb
     list($img_width, $img_height, $img_type, $attr) = @getimagesize($file_path);
     if ($img_width < 122 && $img_height < 91) {
         $src_thumb = $current_path . $rfm_subfolder . $subdir . $file;
         $show_original = true;
     }
开发者ID:met-mw,项目名称:SCMS,代码行数:31,代码来源:dialog.php

示例2: new_thumbnails_creation

function new_thumbnails_creation($targetPath, $targetFile, $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, $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)
{
    //create relative thumbs
    $all_ok = true;
    if ($relative_image_creation) {
        foreach ($relative_path_from_current_pos as $k => $path) {
            if ($path != "" && $path[strlen($path) - 1] != "/") {
                $path .= "/";
            }
            if (!file_exists($targetPath . $path)) {
                create_folder($targetPath . $path, false);
            }
            $info = pathinfo($name);
            if (!endsWith($targetPath, $path)) {
                if (!create_img($targetFile, $targetPath . $path . $relative_image_creation_name_to_prepend[$k] . $info['filename'] . $relative_image_creation_name_to_append[$k] . "." . $info['extension'], $relative_image_creation_width[$k], $relative_image_creation_height[$k])) {
                    $all_ok = false;
                }
            }
        }
    }
    //create fixed thumbs
    if ($fixed_image_creation) {
        foreach ($fixed_path_from_filemanager as $k => $path) {
            if ($path != "" && $path[strlen($path) - 1] != "/") {
                $path .= "/";
            }
            $base_dir = $path . substr_replace($targetPath, '', 0, strlen($current_path));
            if (!file_exists($base_dir)) {
                create_folder($base_dir, false);
            }
            $info = pathinfo($name);
            if (!create_img($targetFile, $base_dir . $fixed_image_creation_name_to_prepend[$k] . $info['filename'] . $fixed_image_creation_to_append[$k] . "." . $info['extension'], $fixed_image_creation_width[$k], $fixed_image_creation_height[$k])) {
                $all_ok = false;
            }
        }
    }
    return $all_ok;
}
开发者ID:alexmon1989,项目名称:fcssadon.ru,代码行数:38,代码来源:utils.php

示例3: pathinfo

     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;
 case 'extract':
     if (strpos($_POST['path'], '/') === 0 || strpos($_POST['path'], '../') !== false || strpos($_POST['path'], './') === 0) {
         response('wrong path', 400)->send();
         exit;
     }
     $path = $current_path . $_POST['path'];
     $info = pathinfo($path);
     $base_folder = $current_path . fix_dirname($_POST['path']) . "/";
     switch ($info['extension']) {
         case "zip":
             $zip = new ZipArchive();
             if ($zip->open($path) === true) {
开发者ID:kipps,项目名称:sri-lanka,代码行数:31,代码来源:ajax_calls.php

示例4: create_img

                    if ($image_max_width != 0 && $srcWidth > $image_max_width && $image_resizing_override === FALSE) {
                        $resize = TRUE;
                        $srcWidth = $image_max_width;
                        if ($image_max_height == 0) {
                            $srcHeight = $image_max_width * $srcHeight / $srcWidth;
                        }
                    }
                    if ($image_max_height != 0 && $srcHeight > $image_max_height && $image_resizing_override === FALSE) {
                        $resize = TRUE;
                        $srcHeight = $image_max_height;
                        if ($image_max_width == 0) {
                            $srcWidth = $image_max_height * $srcWidth / $srcHeight;
                        }
                    }
                    if ($resize) {
                        create_img($targetFile, $targetFile, $srcWidth, $srcHeight, $image_max_mode);
                    }
                }
            }
            // not enough memory
            if ($memory_error) {
                unlink($targetFile);
                header('HTTP/1.1 406 Not enought Memory', TRUE, 406);
                exit;
            }
        }
    } else {
        header('HTTP/1.1 406 file not permitted', TRUE, 406);
        exit;
    }
} else {
开发者ID:ThebingServices,项目名称:ResponsiveFilemanager,代码行数:31,代码来源:upload.php

示例5: parse_links

function parse_links($message, $width = "100%", $height = 120)
{
    // Global pattern to find distinctive links
    $pattern = "%[a-zA-Z\\/\\/:\\.\"\\=]*(                                       # group 1, contains all the other groups\n\t\t\t\t(soundcloud.com\\/[\\w\\*\\-\\?\\&\\%\\=\\.]+\\/[\\w\\*\\-\\?\\&\\%\\=\\.]+)|  # group 2, match links like soundcloud.com/user/sound\n\t\t\t\t(youtube.com\\/watch\\?v\\=)|                                   # group 3, match links like youtube-com/watch?v=videocode\n\t\t\t\t(youtu.be)|                                                  # group 4, match links like youtu.be/videocode\n\t\t\t\t(https?:\\/\\/\\S*\\/\\S*\\.(jpe?g|png|gif)\\b)|                    # group 5, match links like http://mylink.domain/image.png\n\t\t\t\t(https?:\\/\\/)                                                # group 6, match links like http://example.com/page\n\t\t\t\t)+\\S*%xi";
    preg_match_all($pattern, $message, $matched, PREG_SET_ORDER);
    if ($matched) {
        for ($i = 0; $i < count($matched); $i++) {
            // Soundcloud links
            if ($matched[$i][2]) {
                if (strpos($matched[$i][0], 'src="') !== false) {
                    // If there is old iframe code, skip
                } elseif (strpos($matched[$i][0], '/sets/') === false) {
                    $sc = parse_url_ext($matched[$i][0]);
                    $message = str_replace($matched[$i][0], '<sc>' . substr($sc["path"], 1) . '</sc>', $message);
                    $message = soundcloud_iframe($message, $width, $height);
                } else {
                    $message = str_replace($matched[$i][0], create_link($matched[$i][0]), $message);
                }
            } elseif ($matched[$i][3]) {
                $yt = parse_url_ext($matched[$i][0]);
                // Get a clean embed code, without garbage like "&feature=youtu.be"
                if (strpos($yt["query"], "&") === false) {
                    $length = strlen($yt["query"]) - 2;
                } else {
                    $length = strpos($yt["query"], "&") - 2;
                }
                $message = str_replace($matched[$i][0], youtube_iframe(substr($yt["query"], 2, $length), $width, $height), $message);
            } elseif ($matched[$i][4]) {
                $ytbe = parse_url_ext($matched[$i][0]);
                $message = str_replace($matched[$i][0], youtube_iframe(substr($ytbe["path"], 1), $width, $height), $message);
            } elseif ($matched[$i][5]) {
                $message = str_replace($matched[$i][0], create_img($matched[$i][0]), $message);
            } elseif ($matched[$i][7]) {
                $message = str_replace($matched[$i][0], create_link($matched[$i][0]), $message);
            }
        }
    }
    return $message;
}
开发者ID:kmklr72,项目名称:lmms.io,代码行数:39,代码来源:utils.php

示例6: gen_pic

function gen_pic($code, $id, $file)
{
    global $max_line, $img_width, $line_height, $font_size, $font_path;
    # error_log("-----------total code lines:------------");
    $img = null;
    $colors = null;
    $dy = 0;
    # chr(28)-chr(31)作为颜色代号
    $tag = 28;
    # 创建一张150行的图片
    create_img($img, 150, $id, $dy, $colors);
    $code = my_hl($code, $tag);
    $len = strlen($code);
    $y = 1;
    $x = 35;
    $row = 1;
    $pre = $now = 0;
    p_ln($img, $row, $colors[4], $y, $dy);
    $color = $colors[0];
    # 逐个字符遍历高亮后的代码,遇到 [颜色代号],[回车][空格][逗号]则打印到图片
    for ($i = 0; $i < $len; $i++) {
        $c = ord($code[$i]);
        switch ($c) {
            # 4种颜色代号
            case $tag:
            case $tag + 1:
            case $tag + 2:
            case $tag + 3:
                $pre = $now;
                $now = $i - 1;
                if (p_code($img, $pre, $now, $code, $x, $y, $color, $dy)) {
                    break;
                }
                $color = $colors[$c - $tag];
                $now = $i + 1;
                break;
                # 换行符
            # 换行符
            case 13:
                $pre = $now;
                $now = $i - 1;
                if (p_code($img, $pre, $now, $code, $x, $y, $color, $dy)) {
                    break;
                }
                $now = $i + 1;
                $y++;
                $x = 35;
                $row++;
                p_ln($img, $row, $colors[4], $y, $dy);
                break;
                # 空格或者逗号(用于折行)
            # 空格或者逗号(用于折行)
            case 32:
            case ord(','):
                $pre = $now;
                $now = $i;
                if (p_code($img, $pre, $now, $code, $x, $y, $color, $dy)) {
                    break;
                }
                $now = $i + 1;
                break;
        }
        # 超出行数限制(默认100行)
        if ($y >= $max_line) {
            $y++;
            imagettftext($img, $font_size, 0, 80, $y * $line_height + $dy, $colors[3], $font_path, "xxxxx余下源码略xxxxx");
            $y++;
            break;
        }
    }
    # 根据打印出来的代码高度,截短图片存成文件.
    $final_height = $y * $line_height + $dy;
    $new_img = imagecreate($img_width, $final_height);
    imagecolorallocate($new_img, 255, 255, 255);
    imagecopy($new_img, $img, 0, 0, 0, 0, $img_width, $final_height);
    imagepng($new_img, $file);
    imagedestroy($img);
    imagedestroy($new_img);
}
开发者ID:jjling2011,项目名称:code2pic,代码行数:79,代码来源:code.php

示例7: upload

 function upload()
 {
     if (!defined('FMPATH')) {
         define('FMPATH', 'public/vendor/filemanager/');
     }
     include FMPATH . 'config/config.php';
     if ($_SESSION['RF']["verify"] != "RESPONSIVEfilemanager") {
         die('forbiden');
     }
     include FMPATH . 'include/utils.php';
     if (isset($_POST['path'])) {
         $storeFolder = $_POST['path'];
         $storeFolderThumb = $_POST['path_thumb'];
     } else {
         $storeFolder = $current_path . $_POST["fldr"];
         // correct for when IE is in Compatibility mode
         $storeFolderThumb = $thumbs_base_path . $_POST["fldr"];
     }
     $path_pos = strpos($storeFolder, $current_path);
     $thumb_pos = strpos($storeFolderThumb, $thumbs_base_path);
     if ($path_pos !== 0 || $thumb_pos !== 0 || strpos($storeFolderThumb, '../', strlen($thumbs_base_path)) !== FALSE || strpos($storeFolderThumb, './', strlen($thumbs_base_path)) !== FALSE || strpos($storeFolder, '../', strlen($current_path)) !== FALSE || strpos($storeFolder, './', strlen($current_path)) !== FALSE) {
         die('wrong path');
     }
     $path = $storeFolder;
     $cycle = TRUE;
     $max_cycles = 50;
     $i = 0;
     while ($cycle && $i < $max_cycles) {
         $i++;
         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;
             } else {
                 $is_img = FALSE;
             }
             // upload
             move_uploaded_file($tempFile, $targetFile);
             chmod($targetFile, 0755);
             if ($is_img) {
                 $memory_error = FALSE;
                 if (!create_img($targetFile, $targetFileThumb, 122, 91)) {
                     $memory_error = FALSE;
                 } else {
                     // TODO something with this long function baaaah...
                     if (!new_thumbnails_creation($targetPath, $targetFile, $_FILES['file']['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)) {
                         $memory_error = FALSE;
                     } else {
                         $imginfo = getimagesize($targetFile);
                         $srcWidth = $imginfo[0];
                         $srcHeight = $imginfo[1];
                         // resize images if set
                         if ($image_resizing) {
                             if ($image_resizing_width == 0) {
                                 if ($image_resizing_height == 0) {
                                     $image_resizing_width = $srcWidth;
                                     $image_resizing_height = $srcHeight;
                                 } else {
                                     $image_resizing_width = $image_resizing_height * $srcWidth / $srcHeight;
                                 }
                             } elseif ($image_resizing_height == 0) {
                                 $image_resizing_height = $image_resizing_width * $srcHeight / $srcWidth;
                             }
                             // new dims and create
                             $srcWidth = $image_resizing_width;
                             $srcHeight = $image_resizing_height;
                             create_img($targetFile, $targetFile, $image_resizing_width, $image_resizing_height, $image_resizing_mode);
                         }
                         //max resizing limit control
                         $resize = FALSE;
                         if ($image_max_width != 0 && $srcWidth > $image_max_width && $image_resizing_override === FALSE) {
                             $resize = TRUE;
                             $srcWidth = $image_max_width;
//.........这里部分代码省略.........
开发者ID:nurulimamnotes,项目名称:pusakacms,代码行数:101,代码来源:Panel.php


注:本文中的create_img函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。