本文整理汇总了PHP中is_image函数的典型用法代码示例。如果您正苦于以下问题:PHP is_image函数的具体用法?PHP is_image怎么用?PHP is_image使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了is_image函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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:webmaster@lmms.io" . "?subject=LSP 404&body=FYI: 404 Not Found: {$link}\">webmaster@lmms.io</a> of this error.";
}
exit;
}
示例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 "";
}
示例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], '');
}
}
示例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;
}
示例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;");
}
示例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>';
}
}
}
}
}
示例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]);
}
示例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;
}
示例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;
}
示例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';
}
示例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;
}
示例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;
}
示例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);
}
示例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;
}
示例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";
}
}