本文整理汇总了PHP中getImageInfo函数的典型用法代码示例。如果您正苦于以下问题:PHP getImageInfo函数的具体用法?PHP getImageInfo怎么用?PHP getImageInfo使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getImageInfo函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: get_photo_size
function get_photo_size($savepath, $width = 200)
{
$info = getImageInfo($savepath);
list($old_width, $old_height) = $info;
$rate = $old_width / $old_height;
$height = $width / $rate;
return array($width, $height);
}
开发者ID:yang7hua,项目名称:hunshe,代码行数:8,代码来源:common.php
示例2: getColorGrid
function getColorGrid(&$image, $pixelType = PX_ARRAY)
{
$imageInfo = getImageInfo($image);
$colorGrid = array();
for ($y = 0; $y < $imageInfo['height']; $y++) {
$colorGrid[$y] = array();
for ($x = 0; $x < $imageInfo['width']; $x++) {
$colorGrid[$y][$x] = $pixelType === PX_ARRAY ? imagecolorsforindex($image, imagecolorat($image, $x, $y)) : colorToHex(imagecolorsforindex($image, imagecolorat($image, $x, $y)), $pixelType);
}
}
return $colorGrid;
}
开发者ID:0xLeon,项目名称:No.Talent.Spriting,代码行数:12,代码来源:lib.php
示例3: getImageInfo
public function getImageInfo()
{
$data = getImageInfo('2012/1110/18/509e2b90e7a89.jpeg');
dump($data);
}
开发者ID:omusico,项目名称:ThinkSNS-4,代码行数:5,代码来源:TestAction.class.php
示例4: setChannel
/**
* 添加频道与分享的关联信息
* @param integer $sourceId 分享ID
* @param array $channelIds 频道分类ID数组
* @param boolean $isAdmin 是否需要审核,默认为true
* @return boolean 是否添加成功
*/
public function setChannel($feedId, $channelIds, $isAdmin = true)
{
// 格式化数据
!is_array($channelIds) && ($channelIds = explode(',', $channelIds));
// 检验数据
if (empty($feedId)) {
return false;
}
// 删除分享的全部关联
$map['feed_id'] = $feedId;
$res = $this->where($map)->delete();
// 删除成功
if ($res !== false) {
$data['feed_id'] = $feedId;
// 获取图片的高度与宽度
$feedInfo = model('Feed')->get($feedId);
if ($feedInfo['type'] == 'postimage') {
$feedData = unserialize($feedInfo['feed_data']);
$imageAttachId = is_array($feedData['attach_id']) ? $feedData['attach_id'][0] : $feedData['attach_id'];
$attach = model('Attach')->getAttachById($imageAttachId);
$imageInfo = getImageInfo($attach['save_path'] . $attach['save_name']);
if ($imageInfo !== false) {
$data['width'] = ceil($imageInfo[0]);
$data['height'] = ceil($imageInfo[1]);
}
} else {
if ($feedInfo['type'] == 'postvideo') {
$feedData = unserialize($feedInfo['feed_data']);
$imageInfo = getimagesize($feedData['flashimg']);
if ($imageInfo !== false) {
$data['width'] = $imageInfo[0];
$data['height'] = $imageInfo[1];
}
}
}
// 用户UID
$data['uid'] = $feedInfo['uid'];
// 获取后台配置数据
$channelConf = model('Xdata')->get('channel_Admin:index');
$isAudit = $channelConf['is_audit'] == 1 ? false : true;
foreach ($channelIds as $channelId) {
$data['channel_category_id'] = $channelId;
if ($isAdmin) {
$data['status'] = 1;
} else {
if ($isAudit) {
$data['status'] = 0;
} else {
$data['status'] = 1;
}
}
$this->add($data);
}
return true;
}
return false;
}
开发者ID:songhongyu,项目名称:THINKSNS,代码行数:64,代码来源:ChannelModel.class.php
示例5: receiveImage
private function receiveImage($object)
{
require_once 'faceplusplus.php';
$content = getImageInfo((string) $object->PicUrl);
$result = $this->transmitText($object, $content);
return $result;
}
开发者ID:devsnippet,项目名称:WeChat-2,代码行数:7,代码来源:index.php
示例6: saveInfo
private function saveInfo($upload_info, $options)
{
$data = array('table' => t($data['table']), 'row_id' => t($data['row_id']), 'app_name' => t($data['app_name']), 'attach_type' => t($options['attach_type']), 'uid' => (int) $data['uid'] ? $data['uid'] : $GLOBALS['ts']['mid'], 'ctime' => time(), 'private' => $data['private'] > 0 ? 1 : 0, 'is_del' => 0, 'from' => isset($data['from']) ? intval($data['from']) : getVisitorClient());
if ($options['save_to_db']) {
foreach ($upload_info as $u) {
$name = t($u['name']);
$data['name'] = $name ? $name : $u['savename'];
$data['type'] = $u['type'];
$data['size'] = $u['size'];
$data['extension'] = strtolower($u['extension']);
$data['hash'] = $u['hash'];
$data['save_path'] = $options['custom_path'];
$data['save_name'] = $u['savename'];
if (in_array($data['extension'], array('jpg', 'gif', 'png', 'jpeg', 'bmp')) && !in_array($options['attach_type'], array('feed_file', 'weiba_attach'))) {
list($width, $height) = getImageInfo($data['save_path'] . $data['save_name']);
$data['width'] = $width;
$data['height'] = $height;
} else {
$data['width'] = 0;
$data['height'] = 0;
}
$aid = $this->add($data);
$data['attach_id'] = intval($aid);
$data['key'] = $u['key'];
$data['size'] = byte_format($data['size']);
$infos[] = $data;
}
} else {
foreach ($upload_info as $u) {
$name = t($u['name']);
$data['name'] = $name ? $name : $u['savename'];
$data['type'] = $u['type'];
$data['size'] = byte_format($u['size']);
$data['extension'] = strtolower($u['extension']);
$data['hash'] = $u['hash'];
$data['save_path'] = $options['custom_path'];
$data['save_name'] = $u['savename'];
//$data['save_domain'] = C('ATTACH_SAVE_DOMAIN'); //如果做分布式存储,需要写方法来分配附件的服务器domain
$data['key'] = $u['key'];
$infos[] = $data;
}
}
return $infos;
}
开发者ID:lyhiving,项目名称:icampus,代码行数:44,代码来源:AttachModel.class.php
示例7: resize
function resize($ori)
{
if (preg_match('/^http:\\/\\/[a-zA-Z0-9]+/', $ori)) {
return $ori;
}
$info = getImageInfo(AVATARS_PATH . $ori);
if ($info) {
//上传图片后切割的最大宽度和高度
$dst_width = 100;
$dst_height = 100;
$scrimg = AVATARS_PATH . $ori;
if ($info['type'] == 'jpg' || $info['type'] == 'jpeg') {
$im = imagecreatefromjpeg($scrimg);
}
if ($info['type'] == 'gif') {
$im = imagecreatefromgif($scrimg);
}
if ($info['type'] == 'png') {
$im = imagecreatefrompng($scrimg);
}
if ($info['type'] == 'bmp') {
$im = imagecreatefromwbmp($scrimg);
}
if ($info['width'] <= $dst_width && $info['height'] <= $dst_height) {
return;
} else {
if ($info['width'] > $info['height']) {
$height = intval($info['height']);
$width = $height;
$x = ($info['width'] - $width) / 2;
$y = 0;
} else {
$width = intval($info['width']);
$height = $width;
$x = 0;
$y = ($info['height'] - $height) / 2;
}
}
$newimg = imagecreatetruecolor($width, $height);
imagecopy($newimg, $im, 0, 0, $x, $y, $info['width'], $info['height']);
$scale = $dst_width / $width;
$target = imagecreatetruecolor($dst_width, $dst_height);
$final_w = intval($width * $scale);
$final_h = intval($height * $scale);
imagecopyresampled($target, $newimg, 0, 0, 0, 0, $final_w, $final_h, $width, $height);
imagejpeg($target, AVATARS_PATH . $ori);
imagedestroy($im);
imagedestroy($newimg);
imagedestroy($target);
}
return;
}
开发者ID:jackycgq,项目名称:tinection-pro,代码行数:52,代码来源:functions.php
示例8: weibo_photo
public function weibo_photo()
{
// 获取分享配图信息
$uid = $this->data['uid'] ? intval($this->data['uid']) : $this->mid;
$count = $this->count > 0 ? intval($this->count) : 10;
$page = $this->page > 0 ? intval($this->page) : 1;
$feedImages = $this->getUserAttachData($uid, $count, $page);
foreach ($feedImages as &$v) {
$v['imageinfo'] = getImageInfo($v['savepath']);
$v['savepath'] = getImageUrl($v['savepath']);
}
return $feedImages;
}
开发者ID:boxshadow,项目名称:ThinkSNS-4,代码行数:13,代码来源:WeiboStatusesApi.class.php
示例9: glob
<?php
/**
* Creates negative sprites from normal sprites.
*
* @author Stefan Hahn
* @copyright 2011-2012 Stefan Hahn
* @license Simplified BSD License License <http://projects.swallow-all-lies.com/licenses/simplified-bsd-license.txt>
*/
require_once './lib.php';
$sprites = glob('./sprites/*.png');
if (!is_dir('./negative')) {
mkdir('./negative');
}
foreach ($sprites as $sprite) {
$image = imagecreatefrompng($sprite);
$imageInfo = getImageInfo($image);
$newImage = imagecreatetruecolor($imageInfo['width'], $imageInfo['height']);
$colors = array();
echo 'Turning sprite ' . basename($sprite, '.png') . ' to negative' . "\n";
imagealphablending($newImage, false);
imagesavealpha($newImage, true);
imagefill($newImage, 0, 0, imagecolorallocatealpha($newImage, 0xff, 0xff, 0xff, 0x7f));
for ($y = 0; $y < $imageInfo['height']; $y++) {
for ($x = 0; $x < $imageInfo['width']; $x++) {
$color = imagecolorsforindex($image, imagecolorat($image, $x, $y));
if ($color['alpha'] < 0x7f) {
$hex = ownDecHex($color['red']) . ownDecHex($color['green']) . ownDecHex($color['blue']);
if (!isset($colors[$hex])) {
$colors[$hex] = imagecolorallocatealpha($newImage, 0xff - $color['red'], 0xff - $color['green'], 0xff - $color['blue'], 0x0);
}
imagesetpixel($newImage, $x, $y, $colors[$hex]);
开发者ID:0xLeon,项目名称:No.Talent.Spriting,代码行数:31,代码来源:negative.php
示例10: handleOne
function handleOne($picName)
{
global $options;
global $inputInfo;
global $picArr;
$imgInfo = getImageInfo($picName);
$ratio = $options["ratio"];
$w = $imgInfo["width"] / $ratio;
$h = $imgInfo["height"] / $ratio;
// 按宽度分组
$key = null;
if ($options["group"]) {
$key = $w;
} else {
$key = 0;
if ($maxWidth < $w) {
$maxWidth = $w;
}
}
if (!array_key_exists($key, $inputInfo)) {
$inputInfo[$key] = ["x" => 0, "y" => 0, "pics" => []];
}
$e =& $inputInfo[$key];
$pic = ["file" => $picName, "width" => $w, "height" => $h, "x" => $e["x"], "y" => $e["y"]];
$e["pics"][] = $pic;
$picArr[] = $pic;
$e["x"] -= $w;
$e["y"] -= $h;
unset($e);
}
开发者ID:skyshore2001,项目名称:JDCloud,代码行数:30,代码来源:make-sprite.php
示例11: list
if ($width <= 90 && $height <= 90) {
print "*small* ";
}
list($thumbWidth, $thumbHeight, $ignored) = preg_split('/\\|/', getImageInfo($thumbName));
$book->thumbWidth = $thumbWidth;
$book->thumbHeight = $thumbHeight;
$book->save();
} else {
if ($imgType == IMG_NOT_JPEG) {
print " Not an image ";
} else {
print " Corrupted image ";
}
}
} elseif ($alreadyResized) {
list($thumbWidth, $thumbHeight, $ignored) = preg_split('/\\|/', getImageInfo($thumbName));
$book->thumbWidth = $thumbWidth;
$book->thumbHeight = $thumbHeight;
$book->save();
print " Already processed, skipping ";
} else {
print " Cannot fetch image! ";
}
print "\n";
}
function getImageInfo($fileName)
{
$output = OS::executeAndReturnOutput("identify -format \"%w|%h|%b\" \"{$fileName}\"");
assert(count($output) == 1);
return $output[0];
}
开发者ID:nastasie-octavian,项目名称:DEXonline,代码行数:31,代码来源:importDivertaCsv.php
示例12: scaleScale2x
function scaleScale2x(&$image, &$newImage)
{
$imageInfo = getImageInfo($image);
$imageColorGrid = getColorGrid($image, PX_ARGB);
$colors = array();
for ($y = 0; $y < $imageInfo['height']; $y++) {
for ($x = 0; $x < $imageInfo['width']; $x++) {
$scaledPixel = array($imageColorGrid[$y][$x], $imageColorGrid[$y][$x], $imageColorGrid[$y][$x], $imageColorGrid[$y][$x]);
$a = $imageColorGrid[$y === 0 ? $y : $y - 1][$x];
$b = $imageColorGrid[$y][$x === 0 ? $x : $x - 1];
$c = $imageColorGrid[$y][$x === $imageInfo['width'] - 1 ? $x : $x + 1];
$d = $imageColorGrid[$y === $imageInfo['height'] - 1 ? $y : $y + 1][$x];
if ($a !== $d && $b !== $c) {
$scaledPixel[0] = $a === $b ? $b : $scaledPixel[0];
$scaledPixel[1] = $a === $c ? $c : $scaledPixel[1];
$scaledPixel[2] = $b === $d ? $b : $scaledPixel[2];
$scaledPixel[3] = $c === $d ? $c : $scaledPixel[3];
}
if (!isset($colors[$scaledPixel[0]])) {
$colors[$scaledPixel[0]] = imagecolorallocatealpha($newImage, ($scaledPixel[0] & 0xff0000) >> 16, ($scaledPixel[0] & 0xff00) >> 8, $scaledPixel[0] & 0xff, ($scaledPixel[0] & 0xff000000) >> 24);
}
imagesetpixel($newImage, $x * 2, $y * 2, $colors[$scaledPixel[0]]);
if (!isset($colors[$scaledPixel[1]])) {
$colors[$scaledPixel[1]] = imagecolorallocatealpha($newImage, ($scaledPixel[1] & 0xff0000) >> 16, ($scaledPixel[1] & 0xff00) >> 8, $scaledPixel[1] & 0xff, ($scaledPixel[1] & 0xff000000) >> 24);
}
imagesetpixel($newImage, $x * 2 + 1, $y * 2, $colors[$scaledPixel[1]]);
if (!isset($colors[$scaledPixel[2]])) {
$colors[$scaledPixel[2]] = imagecolorallocatealpha($newImage, ($scaledPixel[2] & 0xff0000) >> 16, ($scaledPixel[2] & 0xff00) >> 8, $scaledPixel[2] & 0xff, ($scaledPixel[2] & 0xff000000) >> 24);
}
imagesetpixel($newImage, $x * 2, $y * 2 + 1, $colors[$scaledPixel[2]]);
if (!isset($colors[$scaledPixel[3]])) {
$colors[$scaledPixel[3]] = imagecolorallocatealpha($newImage, ($scaledPixel[3] & 0xff0000) >> 16, ($scaledPixel[3] & 0xff00) >> 8, $scaledPixel[3] & 0xff, ($scaledPixel[3] & 0xff000000) >> 24);
}
imagesetpixel($newImage, $x * 2 + 1, $y * 2 + 1, $colors[$scaledPixel[3]]);
}
}
}
开发者ID:0xLeon,项目名称:No.Talent.Spriting,代码行数:37,代码来源:scale.php
示例13: list
<?php
require "../php/gallery.php";
list($id, $caption, $description) = getImageInfo($_SERVER["REQUEST_URI"], $gallery);
?>
<!doctype html>
<!-- - - - - - - - - - - - - - - - - - - - - - - - -->
<!-- Paradise ~ centerkey.com/paradise -->
<!-- GPLv3 ~ Copyright (c) individual contributors -->
<!-- - - - - - - - - - - - - - - - - - - - - - - - -->
<html>
<head>
<meta charset=utf-8>
<meta name=apple-mobile-web-app-title content="Gallery">
<title><?php
echo $caption;
?>
• <?php
echo $settings->{"title"};
?>
</title>
<link rel=icon href=http://centerkey.com/paradise/graphics/bookmark.png>
<link rel=apple-touch-icon href="../../~data~/portfolio/<?php
echo $id;
?>
-small.png">
<link rel=stylesheet href=https://cdn.jsdelivr.net/fontawesome/4/css/font-awesome.min.css>
<link rel=stylesheet href=https://cdn.jsdelivr.net/dna.js/0/dna.css>
<link rel=stylesheet href=../../css/reset.css>
<link rel=stylesheet href="../../css/style.css">
<link rel=stylesheet href="../../~data~/custom-style.css">
开发者ID:haleystorm,项目名称:paradise,代码行数:31,代码来源:one.php
示例14: pathinfo
$ext = pathinfo($_FILES['file']['name']);
$ext = strtolower($ext['extension']);
$tempFile = $_FILES['file']['tmp_name'];
$targetPath = AVATARS_PATH;
if (!is_dir($targetPath)) {
mkdir($targetPath, 0755, true);
}
$new_file_name = 'avatar-' . $user_id . '.' . $ext;
$targetFile = $targetPath . $new_file_name;
if (!in_array($ext, $filetype)) {
$message = __('仅允许上传JPG、GIF、BMP、PNG图片', 'tinection');
} else {
move_uploaded_file($tempFile, $targetFile);
if (!file_exists($targetFile)) {
$message = __('图片上传失败', 'tinection');
} elseif (!($imginfo = getImageInfo($targetFile))) {
$message = __('图片不存在', 'tinection');
} else {
$img = $new_file_name;
resize($img);
$message = __('头像上传成功', 'tinection');
$update_user_avatar = update_user_meta($user_id, 'tin_avatar', 'customize');
$update_user_avatar_img = update_user_meta($user_id, 'tin_customize_avatar', $img);
}
}
} else {
$update_user_avatar = update_user_meta($user_id, 'tin_avatar', sanitize_text_field($_POST['avatar']));
if (!is_wp_error($update_user_id) || $update_user_avatar) {
$message = __('基本信息已更新', 'tinection');
}
}
开发者ID:jackycgq,项目名称:tinection-pro,代码行数:31,代码来源:author.php
示例15: outputJSON
return $retval;
}
/*
* Output JSON given the imageInfo associative array
*/
function outputJSON($imageInfo, $callback)
{
header('Content-type: text/plain');
$jsonOutput = json_encode($imageInfo);
if ($callback) {
$jsonOutput = $callback . '(' . $jsonOutput . ');';
}
echo $jsonOutput;
}
// Get the image size and depth
$imageInfo = getImageInfo($zipPath, $file);
// Output json if requested
if ('json' == $ext) {
// $$$ we should determine the output size first based on requested scale
outputJSON($imageInfo, $callback);
exit;
}
// Unfortunately kakadu requires us to know a priori if the
// output file should be .ppm or .pgm. By decompressing to
// .bmp kakadu will write a file we can consistently turn into
// .pnm. Really kakadu should support .pnm as the file output
// extension and automatically write ppm or pgm format as
// appropriate.
$decompressToBmp = true;
if ($decompressToBmp) {
$stdoutLink = '/tmp/stdout.bmp';
开发者ID:scollett,项目名称:bookreader,代码行数:31,代码来源:BookReaderImages.php
注:本文中的getImageInfo函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论