• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP is_image函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: download_file

function download_file($file_id, $file_name)
{
    global $DATA_DIR;
    $file_path = $DATA_DIR . $file_id;
    if (file_exists($file_path)) {
        increment_file_downloads($file_id);
        $content_type = get_content_type($file_name);
        header("Content-type: {$content_type}");
        $user_agent = $_SERVER['HTTP_USER_AGENT'];
        if (!is_image($file_name)) {
            if (is_integer(strpos($user_agent, "msie")) && is_integer(strpos($user_agent, "win"))) {
                header("Content-Disposition:filename=\"{$file_name}\"");
            } else {
                header("Content-Disposition: attachment; filename=\"{$file_name}\"");
            }
            header("Content-Description: Download");
        }
        ob_clean();
        flush();
        readfile($file_path);
    } else {
        require_once 'dbo.php';
        header("HTTP/1.0 404 Not Found");
        echo "<h1>HTTP/1.0 404 Not Found</h1>";
        $link = "http://{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}";
        echo "Sorry, file was not found.  Please notify <a href=\"mailto:[email protected]" . "?subject=LSP 404&body=FYI: 404 Not Found: {$link}\">[email protected]</a> of this error.";
    }
    exit;
}
开发者ID:kmklr72,项目名称:lmms.io,代码行数:29,代码来源:download_file.php


示例2: getFirstImage

 public function getFirstImage($module, $attachment_id, $attachment_name)
 {
     if ($attachment_id == "") {
         return "";
     }
     $attachment_id_array = explode(",", $attachment_id);
     $attachment_name_array = explode("*", $attachment_name);
     $array_count = sizeof($attachment_id_array);
     $i = 0;
     for (; $i < $array_count; ++$i) {
         if ($attachment_id_array[$i] == "") {
             continue;
         }
         $attachment_id1 = $attachment_id_array[$i];
         $ym = substr($attachment_id1, 0, strpos($attachment_id1, "_"));
         if ($ym) {
             $attachment_id1 = substr($attachment_id1, strpos($attachment_id, "_") + 1);
         }
         $attachment_id_encoded = attach_id_encode($attachment_id1, $attachment_name_array[$i]);
         $url_array = attach_url($attachment_id_array[$i], $attachment_name_array[$i], $module, $other);
         if (!is_image($attachment_name_array[$i])) {
             continue;
         }
         return "/inc/attach.php?MODULE=" . $module . "&YM=" . $ym . "&ATTACHMENT_ID=" . $attachment_id_encoded . "&ATTACHMENT_NAME=" . urlencode($attachment_name_array[$i]) . "&DIRECT_VIEW=1";
     }
     return "";
 }
开发者ID:sany217,项目名称:WeiXin,代码行数:27,代码来源:oa.modules.php


示例3: post_process

 /**
  * The second last process, should only be getting everything
  * syntaxically correct, rather than doing any heavy processing
  *
  * @author Anthony Short
  * @return $css string
  */
 public static function post_process()
 {
     if ($found = CSS::find_properties_with_value('image-replace', 'url\\([\'\\"]?([^)]+)[\'\\"]?\\)')) {
         foreach ($found[4] as $key => $value) {
             $path = $url = str_replace("\\", "/", unquote($value));
             # If they're getting an absolute file
             if ($path[0] == "/") {
                 $path = DOCROOT . ltrim($path, "/");
             }
             # Check if it exists
             if (!file_exists($path)) {
                 FB::log("ImageReplace - Image doesn't exist " . $path);
             }
             # Make sure it's an image
             if (!is_image($path)) {
                 FB::log("ImageReplace - File is not an image: {$path}");
             }
             // Get the size of the image file
             $size = GetImageSize($path);
             $width = $size[0];
             $height = $size[1];
             // Make sure theres a value so it doesn't break the css
             if (!$width && !$height) {
                 $width = $height = 0;
             }
             // Build the selector
             $properties = "\n\t\t\t\t\tbackground:url({$url}) no-repeat 0 0;\n\t\t\t\t\theight:{$height}px;\n\t\t\t\t\twidth:{$width}px;\n\t\t\t\t\tdisplay:block;\n\t\t\t\t\ttext-indent:-9999px;\n\t\t\t\t\toverflow:hidden;\n\t\t\t\t";
             CSS::replace($found[2][$key], $properties);
         }
         # Remove any left overs
         CSS::replace($found[1], '');
     }
 }
开发者ID:Keukendeur,项目名称:csscaffold,代码行数:40,代码来源:ImageReplace.php


示例4: cpgUserLastComment

function cpgUserLastComment($uid)
{
    global $CONFIG, $FORBIDDEN_SET;
    $result = cpg_db_query("SELECT COUNT(*), MAX(msg_id) FROM {$CONFIG['TABLE_COMMENTS']} AS c INNER JOIN {$CONFIG['TABLE_PICTURES']} AS p ON p.pid = c.pid WHERE approval = 'YES' AND author_id = '{$uid}' {$FORBIDDEN_SET}");
    list($comment_count, $lastcom_id) = mysql_fetch_row($result);
    mysql_free_result($result);
    $lastComArray = array('count' => 0);
    if ($comment_count) {
        $sql = "SELECT filepath, filename, url_prefix, pwidth, pheight, msg_author, UNIX_TIMESTAMP(msg_date) as msg_date, msg_body FROM {$CONFIG['TABLE_COMMENTS']} AS c INNER JOIN {$CONFIG['TABLE_PICTURES']} AS p ON p.pid = c.pid WHERE msg_id = {$lastcom_id}";
        $result = cpg_db_query($sql);
        if (mysql_num_rows($result)) {
            $row = mysql_fetch_assoc($result);
            $pic_url = get_pic_url($row, 'thumb');
            if (!is_image($row['filename'])) {
                $image_info = cpg_getimagesize(urldecode($pic_url));
                $row['pwidth'] = $image_info[0];
                $row['pheight'] = $image_info[1];
            }
            $image_size = compute_img_size($row['pwidth'], $row['pheight'], $CONFIG['thumb_width']);
            $lastcom = '<img src="' . $pic_url . '" class="image"' . $image_size['geom'] . ' border="0" alt="" />';
            $lastComArray = array('thumb' => $lastcom, 'comment' => $row['msg_body'], 'msg_date' => $row['msg_date'], 'count' => $comment_count);
        }
        mysql_free_result($result);
    }
    return $lastComArray;
}
开发者ID:stephenjschaefer,项目名称:APlusPhotography,代码行数:26,代码来源:profile.php


示例5: caching

function caching($comics_id, $zip_path, $image_ext)
{
    $comic = zip_open($zip_path);
    if (!is_resource($comic)) {
        die("[ERR]ZIP_OPEN : " . $zip_path);
    }
    $inzip_path = "";
    $count = 0;
    $files = null;
    $db = new SQLite3(DB);
    $db->exec("BEGIN DEFERRED;");
    while (($entry = zip_read($comic)) !== false) {
        $inzip_path = zip_entry_name($entry);
        $cache_name = md5($zip_path . "/" . $inzip_path) . '.' . get_ext($inzip_path);
        // 画像か否か
        if (!is_image($inzip_path, $image_ext)) {
            continue;
        }
        $data = zip_entry_read($entry, zip_entry_filesize($entry));
        $filepath = CACHE . '/' . $cache_name;
        file_put_contents($filepath, $data);
        $count++;
        query("INSERT INTO images (comics_id, page, filepath) VALUES (" . $comics_id . ", " . $count . ", '" . $filepath . "')", $db);
    }
    zip_close($comic);
    query("UPDATE comics SET pages = " . $count . " WHERE id = " . $comics_id, $db);
    $db->exec("COMMIT;");
}
开发者ID:undisputed-seraphim,项目名称:manga_server,代码行数:28,代码来源:view.php


示例6: create_gallery

function create_gallery()
{
    global $types_ok;
    $chemin = "images/projects_filtres";
    if ($handle = opendir($chemin)) {
        $img = '';
        $count = 0;
        while (($filename = readdir($handle)) !== FALSE) {
            $count++;
            // c'est une image?
            $chemin_image = $chemin . '/' . $filename;
            if (!is_dir($chemin_image)) {
                if (is_image($chemin_image)) {
                    $tab_ficher = explode('.', $filename);
                    // Le nom du fichier [1]= extension
                    $tab_details_nom = explode('-', $tab_ficher[0]);
                    $tab_filtres = explode('_', $tab_details_nom[1]);
                    // var_dump($tab_filtres);
                    $filters = implode(' ', $tab_filtres);
                    echo '<li class="element ' . $filters . '">';
                    echo '<a href="' . $chemin_image . '"><img src="images/projects/img' . $count . '.jpg" alt="" /></a>';
                    echo '</li>';
                }
            }
        }
    }
}
开发者ID:nWidart,项目名称:TPWeb_Gallerie,代码行数:27,代码来源:index.php


示例7: update

 /**
  * Update the specified resource in storage.
  *
  * @param  \Illuminate\Http\Request $request
  * @param  int $mcid
  * @return \Illuminate\Http\Response
  */
 public function update(Request $request, $mcid_id)
 {
     $this->validate($request, ['file' => 'required']);
     $mcid = MCID::findOrFail($mcid_id);
     $file = $_FILES['file'];
     $fileName = md5($mcid_id . $file['name'] . time());
     $path = str_finish($this->skin_path, '/') . $fileName;
     $content = File::get($file['tmp_name']);
     if (is_image($file['type']) && $file['size'] <= 150 * 1000) {
         list($img_w, $img_h) = getimagesize($file['tmp_name']);
         if ($img_w > 64 || $img_h > 64) {
             $error = "皮肤文件 '{$fileName}' 尺寸不正确.";
         } else {
             $result = $this->manager->saveFile($path, $content);
             if ($result === true) {
                 $skin = Skin::where('mcid_id', $mcid->id)->first();
                 if ($skin == null) {
                     $skin = new Skin();
                 }
                 $skin->mcid_id = $mcid->id;
                 $skin->url = $path;
                 $skin->save();
                 return redirect()->back()->withSuccess("皮肤文件 '{$fileName}' 上传成功.");
             } else {
                 $error = $result ?: "皮肤文件 '{$fileName}' 上传失败.";
             }
         }
     } else {
         $error = "皮肤文件 '{$fileName}' 格式或大小不正确.";
     }
     return redirect()->back()->withErrors([$error]);
 }
开发者ID:AsakuraFuuko,项目名称:MineCraft-Skin,代码行数:39,代码来源:SkinController.php


示例8: get_images_list

function get_images_list()
{
    $S = array();
    foreach (scandir(IDIR) as $O) {
        $I = IDIR . $O;
        if (is_image($I) && is_readable($I)) {
            array_push($S, $O);
        }
    }
    return $S;
}
开发者ID:fbianco,项目名称:MimingGallery,代码行数:11,代码来源:index.php


示例9: get_images_list

function get_images_list()
{
    // Return a list of readable images in IDIR
    $images_list = array();
    foreach (scandir(IDIR) as $fname) {
        $fpath = IDIR . $fname;
        if (is_image($fpath) && is_readable($fpath)) {
            array_push($images_list, $fname);
        }
    }
    return $images_list;
}
开发者ID:fbianco,项目名称:MimingGallery,代码行数:12,代码来源:gallery.ajax.php


示例10: upurlsav

function upurlsav($dr, $o, $u)
{
    $u = ajxg($u);
    if (!is_image($u)) {
        return 'no';
    }
    $ret = get_file($u);
    $nm = strrchr($u, '/');
    $f = 'users/' . $dr . '/' . $nm;
    write_file($f, $ret);
    return 'ok';
}
开发者ID:philum,项目名称:cms,代码行数:12,代码来源:upload.php


示例11: is_lsp_image

function is_lsp_image($file_path)
{
    if (!is_image($file_path) || explode("download_file.php", $file_path) < 2) {
        return false;
    }
    $parsed = parse_url($file_path);
    if (isset($parsed['query'])) {
        $query = array();
        parse_str($parsed['query'], $query);
        return $query['file'];
    }
    return false;
}
开发者ID:kmklr72,项目名称:lmms.io,代码行数:13,代码来源:utils.php


示例12: ifrget

function ifrget($a, $b, $f)
{
    $f = ajxg($f);
    if ($f) {
        $f = str_replace(array("\n", "\r"), ' ', $f);
        $r = explode(' ', $f);
        foreach ($r as $v) {
            $d = curl_get_contents($v);
            if (is_image($v) && $d) {
                $ret .= ifrim($v, $d);
            }
        }
    }
    return $ret;
}
开发者ID:philum,项目名称:cms,代码行数:15,代码来源:ifrm.php


示例13: directory_thumb_mirror

 /**
  * Create filename-mirrored thumbnails for the given directory stub (mirrors stub/foo with stub_thumbs/foo).
  *
  * @param  string		Directory to mirror
  */
 function directory_thumb_mirror($dir)
 {
     require_code('images');
     $full = get_custom_file_base() . '/uploads/' . $dir;
     $dh = @opendir($full);
     if ($dh !== false) {
         while (($file = readdir($dh)) !== false) {
             $target = get_custom_file_base() . '/' . $dir . '_thumbs/' . $file;
             if (!file_exists($target) && is_image($full . '/' . $file)) {
                 require_code('images');
                 convert_image($full . '/' . $file, $target, -1, -1, intval(get_option('thumb_width')));
             }
         }
     }
     closedir($dh);
 }
开发者ID:erico-deh,项目名称:ocPortal,代码行数:21,代码来源:image_thumbs.php


示例14: ifrget

function ifrget($a, $b, $f)
{
    $f = ajxg($f);
    $f = http($f);
    if ($f) {
        $ret = curl_get_contents($f);
        if (is_image($f) && $ret) {
            $ret = ifrim($f, $ret);
        }
    }
    $encoding = embed_detect(strtolower($ret), "charset=", '"', "");
    if (strtolower($encoding) == "utf-8" or strpos($ret, 'é')) {
        $ret = utf8_decode_b($ret);
    }
    return $ret;
}
开发者ID:philum,项目名称:cms,代码行数:16,代码来源:ifr.php


示例15: get_thumbnail

 /**
  * Retrieve image thumbnail
  * 
  * @param  string $mime
  * @return string
  */
 function get_thumbnail($mime, $forImage)
 {
     if (is_image($mime)) {
         return $forImage;
     } elseif (is_video($mime)) {
         return "/vendor/inoplate-media/images/medias/video_128px.png";
     } elseif (is_audio($mime)) {
         return "/vendor/inoplate-media/images/medias/music_128px.png";
     } elseif ($mime == 'application/excel' || $mime == 'application/vnd.ms-excel' || $mime == 'application/x-excel' || $mime == 'application/x-msexcel') {
         return "/vendor/inoplate-media/images/medias/xls_128px.png";
     } elseif ($mime == 'application/mspowerpoint' || $mime == 'application/powerpoint' || $mime == 'application/vnd.ms-powerpoint' || $mime == 'application/x-mspowerpoint') {
         return "/vendor/inoplate-media/images/medias/xls_128px.png";
     } else {
         return "/vendor/inoplate-media/images/medias/file_128px.png";
     }
 }
开发者ID:inoplate,项目名称:media,代码行数:22,代码来源:helpers.php


示例16: user_handle_profile_picture

/**
 * Handle user's profile picture modification
 * (based on $_REQUEST['delPicture'] and $_FILE['picture'].
 *
 * @return  $feedback array (yes, it is kinda ugly)
 */
function user_handle_profile_picture($userData)
{
    $feedback = array('success' => false, 'messages' => array(), 'pictureName' => '');
    // Handle user picture
    if (!empty($_REQUEST['delPicture'])) {
        $picturePath = user_get_picture_path($userData);
        if ($picturePath) {
            claro_delete_file($picturePath);
            $feedback['success'] = true;
            $feedback['messages'][] = get_lang("User picture deleted");
        } else {
            $feedback['messages'][] = get_lang("Cannot delete user picture");
        }
    }
    if (isset($_FILES['picture']['name']) && $_FILES['picture']['size'] > 0) {
        $fileName = $_FILES['picture']['name'];
        $fileTmpName = $_FILES['picture']['tmp_name'];
        if (is_uploaded_file($fileTmpName)) {
            // Is it an picture ?
            if (is_image($fileName)) {
                // Does it meet the platform's requirements
                list($width, $height, $type, $attr) = getimagesize($fileTmpName);
                if ($width > 0 && $width <= get_conf('maxUserPictureWidth', 150) && $height > 0 && $height <= get_conf('maxUserPictureHeight', 200) && $_FILES['picture']['size'] <= get_conf('maxUserPictureSize', 100 * 1024)) {
                    $uploadDir = user_get_private_folder_path($userData['user_id']);
                    if (!file_exists($uploadDir)) {
                        claro_mkdir($uploadDir, CLARO_FILE_PERMISSIONS, true);
                    }
                    // User's picture successfully treated
                    if (false !== ($pictureName = treat_uploaded_file($_FILES['picture'], $uploadDir, '', 1000000000000.0))) {
                        $feedback['success'] = true;
                        $feedback['messages'][] = get_lang("User picture added");
                        $feedback['pictureName'] = $pictureName;
                    } else {
                        $feedback['messages'][] = get_lang("Cannot upload file");
                    }
                } else {
                    $feedback['messages'][] = get_lang("Image is too big : max size %width%x%height%, %size% bytes", array('%width%' => get_conf('maxUserPictureWidth', 150), '%height%' => get_conf('maxUserPictureHeight', 200), '%size%' => get_conf('maxUserPictureHeight', 100 * 1024)));
                }
            } else {
                $feedback['messages'][] = get_lang("Invalid file format, use gif, jpg or png");
            }
        } else {
            $feedback['messages'][] = get_lang('Upload failed');
        }
    }
    return $feedback;
}
开发者ID:rhertzog,项目名称:lcs,代码行数:53,代码来源:user.lib.php


示例17: recurse_dir

/**
 * Recurses into a directory and writes the structure
 * in an associative array
 * @global string $pictureDir from config.php
 * @param string $directory The directory to recurse into
 * @param array $array The array to put the results in
 * @param int $depth How deep should it go? (Default 1)
 * @return array
 * 
 */
function recurse_dir($directory, $array, $depth = 1, $include_info = true, $full_path = false)
{
    //    echo $directory,"<br><br>";
    global $pictureDir;
    $dirName = basename($directory);
    if (!is_dir($directory)) {
        include '404.php';
    }
    $gallery_info = getGalleryInfo($dirName);
    //get images to be ignored from gallery.json
    if (is_array($gallery_info["ignore"])) {
        $ignore_images = $gallery_info["ignore"];
    } else {
        $ignore_images = array();
    }
    if ($handle = opendir($directory)) {
        //for each entry found inside $directory
        while (false !== ($entry = readdir($handle))) {
            $path = $directory . "/" . $entry;
            //echo "$pictureDir -- $dirName -- $path -- $entry \n </br>";
            //ignore . and .. , write directories to the array and recurse into them
            if ($entry != "." && $entry != ".." && !in_array($entry, $ignore_images)) {
                if (is_dir($path)) {
                    $array[$entry] = array();
                    if ($include_info) {
                        $array[$entry]["__info__"] = getGalleryInfo($path);
                    }
                    if ($depth != 0) {
                        $array[$entry] = recurse_dir($path, $array[$entry], $depth - 1, $include_info, $full_path);
                    }
                } else {
                    if (is_image($path)) {
                        $array[$entry] = $full_path ? $path : $entry;
                    }
                }
            }
        }
        closedir($handle);
    }
    //echo "final"; _print_r($array);
    return $array;
}
开发者ID:qwazix,项目名称:viood,代码行数:52,代码来源:functions.php


示例18: init

 public function init($media, $model)
 {
     $this->model = $model;
     $this->media = $media;
     echo 'myFunction is OK' . $media;
     if (Input::hasFile($media) && Input::file($media)->isValid()) {
         $newMedia = Input::file($media);
         $mediaType = is_image($newMedia->getMimeType()) == 'image' ? 'images' : 'docs';
         $destinationPath = config('laraCms.admin.path.repository') . '/' . $mediaType;
         // upload path
         $extension = $newMedia->getClientOriginalExtension();
         // getting image extension
         $name = basename($newMedia->getClientOriginalName(), '.' . $extension);
         $fileName = str_slug(rand(11111, 99999) . '_' . $name) . "." . $extension;
         // renameing image
         $newMedia->move($destinationPath, $fileName);
         // uploading file to given path
         echo $this->model->{$media} = $fileName;
     }
 }
开发者ID:marcoax,项目名称:laraCms,代码行数:20,代码来源:UploadManager.php


示例19: ifrget

function ifrget($a, $b, $f)
{
    $f = ajxg($f);
    $f = http($f);
    if ($a) {
        ifradd();
    }
    if ($f) {
        $ret = read_file($f);
        $ret = ifrcorr($ret, $f);
        if (is_image($f) && $ret) {
            $ret = ifrim($f, $ret);
        }
    }
    $encoding = embed_detect(strtolower($ret), "charset=", '"', "");
    if (strtolower($encoding) == "utf-8" or strpos($ret, 'é')) {
        $ret = utf8_decode_b($ret);
    }
    return $ret;
}
开发者ID:philum,项目名称:cms,代码行数:20,代码来源:ifram.php


示例20: uploadifive

 /**
  * @param Request $request
  * @return \Illuminate\Http\JsonResponse
  */
 public function uploadifive(Request $request)
 {
     $media = 'Filedata';
     if (Input::hasFile($media) && Input::file($media)->isValid()) {
         $newMedia = Input::file($media);
         $mediaType = is_image($newMedia->getMimeType()) == 'image' ? 'images' : 'docs';
         $destinationPath = $mediaType;
         // upload path folder
         $extension = $newMedia->getClientOriginalExtension();
         // getting image extension
         $name = basename($newMedia->getClientOriginalName(), '.' . $extension);
         $fileName = str_slug($newMedia->getClientOriginalName());
         $mediaPath = public_path('media/' . $destinationPath . '/' . $fileName);
         // renaming image if exist
         if (file_exists($mediaPath)) {
             $fileName = str_slug(rand(11111, 99999) . '_' . $name) . "." . $extension;
         }
         $storage = \Storage::disk('media');
         $storage->put($destinationPath . '/' . $fileName, file_get_contents($newMedia), 'public');
         if (is_image($newMedia->getMimeType()) == 'image') {
             $img = Image::make(public_path('media/' . $destinationPath . '/' . $fileName))->widen(1600);
             // save file as png with medium quality
             $img->save(public_path('media/' . $destinationPath . '/' . $fileName, 60));
         }
         $modelClass = 'App\\' . $request->model;
         $list = $modelClass::find($request->Id);
         $c = new Media();
         $c->title = $fileName;
         $c->file_name = $fileName;
         $c->size = $newMedia->getClientSize();
         $c->collection_name = $mediaType;
         $c->disk = $destinationPath;
         $c->media_category_id = $request->myImgType;
         $c->file_ext = $extension;
         $list->media()->save($c);
         $this->responseContainer['status'] = 'ok';
         $this->responseContainer['data'] = $mediaType;
         return $this->responseHandler();
     }
 }
开发者ID:marcoax,项目名称:laraCms,代码行数:44,代码来源:AjaxController.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP is_image_file函数代码示例发布时间:2022-05-15
下一篇:
PHP is_ie函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap