agid])) {
foreach ($g_flag_thread[$flagid] as &$val) {
flag_thread_filter($val);
}
flag_thread_set($flagid, $g_flag_thread[$flagid]);
}
}
return $g_flag_thread[$flagid];
}
// 设置缓存 $key = flagid / $val = flagid下tid数组
function flag_thread_set($key, $val)
{
global $g_flag_thread;
FALSE === $g_flag_thread and $g_flag_thread = website_get('flag_thread');
empty($g_flag_thread) and $g_flag_thread = array();
$g_flag_thread[$key] = $val;
return website_set('flag_thread', $g_flag_thread);
}
// 删除flag下tid缓存
function flag_thread_delete_cache($flagid)
{
global $g_flag_thread;
FALSE === $g_flag_thread and $g_flag_thread = website_get('flag_thread');
empty($g_flag_thread) and $g_flag_thread = array();
if (isset($g_flag_thread[$flagid])) {
unset($g_flag_thread[$flagid]);
website_set('flag_thread', $g_flag_thread);
}
return TRUE;
}
// Delete by tid / 通过tid删除flag下的主题和对应flagid缓存
function flag_thread_delete_by_tid($tid)
{
global $g_flag_thread;
FALSE === $g_flag_thread and $g_flag_thread = website_get('flag_thread');
if (empty($g_flag_thread)) {
$g_flag_thread = array();
} else {
$thread = well_thread_read_cache($tid);
$arrlist = flag_thread_find($tid, 1, $thread['flags']);
$flagarr = $ids = array();
foreach ($arrlist as $val) {
$flagarr[] = $val['flagid'];
$ids[] = $val['id'];
if (isset($g_flag_thread[$val['flagid']])) unset($g_flag_thread[$val['flagid']]);
}
website_set('flag_thread', $g_flag_thread);
// 主键更新
flag_update($flagarr, array('count-' => 1));
// 主键删除
flag_thread_delete($ids);
}
return TRUE;
}
// 主键删除 通过$flagid删除flag下的主题和对应flagid缓存
function flag_thread_delete_by_flagid($flagid)
{
global $g_flag_thread;
FALSE === $g_flag_thread and $g_flag_thread = website_get('flag_thread');
$read = flag_read_cache($flagid);
if (empty($read)) return TRUE;
$arrlist = flag_thread_find_by_flagid($flagid, 1, $read['count']);
if (empty($arrlist)) return TRUE;
$flagarr = $ids = array();
$n = 0;
foreach ($arrlist as $val) {
++$n;
$flagarr[] = $val['flagid'];
$ids[] = $val['id'];
if (isset($g_flag_thread[$flagid])) unset($g_flag_thread[$flagid]);
}
website_set('flag_thread', $g_flag_thread);
// 主键更新
flag_update($flagarr, array('count-' => $n));
// 主键删除
$r = flag_thread_delete($ids);
return $r;
}
?>break;
}
$r = array('filesize' => filesize($tmpfile), 'width' => $des_width, 'height' => $des_height);;
copy($tmpfile, $destfile);
is_file($tmpfile) && unlink($tmpfile);
imagedestroy($img_dst);
return $r;
}
/**
* 图片裁切
*
* @param string $sourcefile 原图片路径(绝对路径/abc.jpg)
* @param string $destfile 裁切后生成新名称(绝对路径/rename.jpg)
* @param int $clipx 被裁切图片的X坐标
* @param int $clipy 被裁切图片的Y坐标
* @param int $clipwidth 被裁区域的宽度
* @param int $clipheight 被裁区域的高度
* image_clip('xxx/x.jpg', 'xxx/newx.jpg', 10, 40, 150, 150)
*/
function well_image_clip($sourcefile, $destfile, $clipx, $clipy, $clipwidth, $clipheight, $getimgsize = '')
{
global $conf;
empty($getimgsize) AND $getimgsize = getimagesize($sourcefile);
if (empty($getimgsize)) {
return 0;
} else {
$imgwidth = $getimgsize[0];
$imgheight = $getimgsize[1];
if (0 == $imgwidth || 0 == $imgheight) {
return 0;
}
}
if (!function_exists('imagecreatefromjpeg')) {
copy($sourcefile, $destfile);
return filesize($destfile);
}
switch ($getimgsize[2]) {
case 1 :
$imgcolor = imagecreatefromgif($sourcefile);
break;
case 2 :
$imgcolor = imagecreatefromjpeg($sourcefile);
break;
case 3 :
$imgcolor = imagecreatefrompng($sourcefile);
break;
case 15: // WBMP
$imgcolor = imagecreatefromwbmp($sourcefile);
break;
case 18: // WEBP
$imgcolor = imagecreatefromwebp($sourcefile);
break;
}
if (!$imgcolor) return 0;
$img_dst = imagecreatetruecolor($clipwidth, $clipheight);
imagefill($img_dst, 0, 0, 0xFFFFFF);
imagecopyresampled($img_dst, $imgcolor, 0, 0, $clipx, $clipy, $imgwidth, $imgheight, $imgwidth, $imgheight);
$tmppath = isset($conf['tmp_path']) ? $conf['tmp_path'] : ini_get('upload_tmp_dir') . '/';
'/' == $tmppath AND $tmppath = './tmp/';
$tmpfile = $tmppath . md5($destfile) . '.tmp';
imagejpeg($img_dst, $tmpfile, 75);
$n = filesize($tmpfile);
copy($tmpfile, $destfile);
is_file($tmpfile) && unlink($tmpfile);
return $n;
}
function well_image_ext($filename) {
return strtolower(substr(strrchr($filename, '.'), 1));
}
?>
signature=946b61359fb7b919b57e636da83bf538,X-软件玩家 - 软件改变生活!
signature=946b61359fb7b919b57e636da83bf538,X
摘要:
THERE have now been described a number of moving-anode X-ray tubes, including the mercury-sealed type developed in this Laboratory1–4, and their high performance may be regarded as established. They are, however, mostly expensive and not easy to build, and for the future welfare of X-ray structure analysis, particularly in the fibre and protein fields, something is needed for workers with modest resources—something that does not aim at the power that can be realized with a rotating anode, yet is considerably better than the stationary-anode tubes commonly in use. We have designed and constructed such a simple, demountable and inexpensive tube as follows.
展开
本文标签:
signature946b61359fb7b919b57e636da83bf538 x
发表评论