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

PHP get_width函数代码示例

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

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



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

示例1: pic_cutOp

 /**
  * 图片裁剪
  *
  */
 public function pic_cutOp()
 {
     import('function.thumb');
     if (chksubmit()) {
         $thumb_width = $_POST['x'];
         $x1 = $_POST["x1"];
         $y1 = $_POST["y1"];
         $x2 = $_POST["x2"];
         $y2 = $_POST["y2"];
         $w = $_POST["w"];
         $h = $_POST["h"];
         $scale = $thumb_width / $w;
         $src = str_ireplace(UPLOAD_SITE_URL, BASE_UPLOAD_PATH, $_POST['url']);
         $save_file2 = str_replace('_small.', '_sm.', $src);
         $cropped = resize_thumb($save_file2, $src, $w, $h, $x1, $y1, $scale);
         @unlink($src);
         $pathinfo = pathinfo($save_file2);
         exit($pathinfo['basename']);
     } else {
         Language::read('cut');
         $lang = Language::getLangContent();
     }
     $save_file = str_ireplace(UPLOAD_SITE_URL, BASE_UPLOAD_PATH, $_GET['url']);
     $_GET['x'] = intval($_GET['x']) > 50 && $_GET['x'] < 400 ? $_GET['x'] : 200;
     $_GET['y'] = intval($_GET['y']) > 50 && $_GET['y'] < 400 ? $_GET['y'] : 200;
     $_GET['resize'] = $_GET['resize'] == '0' ? '0' : '1';
     Tpl::output('height', get_height($save_file));
     Tpl::output('width', get_width($save_file));
     Tpl::showpage('cut', 'null_layout');
 }
开发者ID:norain2050,项目名称:xingkang,代码行数:34,代码来源:cut.php


示例2: pic_cutOp

 /**
  * 图片裁剪
  *
  */
 public function pic_cutOp()
 {
     Language::read('admin_common');
     $lang = Language::getLangContent();
     import('function.thumb');
     if (chksubmit()) {
         $thumb_width = $_POST['x'];
         $x1 = $_POST["x1"];
         $y1 = $_POST["y1"];
         $x2 = $_POST["x2"];
         $y2 = $_POST["y2"];
         $w = $_POST["w"];
         $h = $_POST["h"];
         $scale = $thumb_width / $w;
         $src = str_ireplace(UPLOAD_SITE_URL, BASE_UPLOAD_PATH, $_POST['url']);
         if (strpos($src, '..') !== false || strpos($src, BASE_UPLOAD_PATH) !== 0) {
             exit;
         }
         if (!empty($_POST['filename'])) {
             // 				$save_file2 = BASE_UPLOAD_PATH.'/'.$_POST['filename'];
             $save_file2 = str_ireplace(UPLOAD_SITE_URL, BASE_UPLOAD_PATH, $_POST['filename']);
         } else {
             $save_file2 = str_replace('_small.', '_sm.', $src);
         }
         $cropped = resize_thumb($save_file2, $src, $w, $h, $x1, $y1, $scale);
         @unlink($src);
         $pathinfo = pathinfo($save_file2);
         exit($pathinfo['basename']);
     }
     $save_file = str_ireplace(UPLOAD_SITE_URL, BASE_UPLOAD_PATH, $_GET['url']);
     $_GET['resize'] = $_GET['resize'] == '0' ? '0' : '1';
     Tpl::output('height', get_height($save_file));
     Tpl::output('width', get_width($save_file));
     Tpl::showpage('common.pic_cut', 'null_layout');
 }
开发者ID:ff00x0,项目名称:shopnc-api,代码行数:39,代码来源:common.php


示例3: uploadOp

 public function uploadOp()
 {
     if (!chksubmit()) {
         redirect('index.php?act=home&op=avatar');
     }
     import('function.thumb');
     Language::read('member_home_member,cut');
     $lang = Language::getLangContent();
     $member_id = $_SESSION['member_id'];
     //上传图片
     $upload = new UploadFile();
     $upload->set('thumb_width', 500);
     $upload->set('thumb_height', 499);
     $ext = strtolower(pathinfo($_FILES['pic']['name'], PATHINFO_EXTENSION));
     $upload->set('file_name', "avatar_{$member_id}.{$ext}");
     $upload->set('thumb_ext', '_new');
     $upload->set('ifremove', true);
     $upload->set('default_dir', ATTACH_AVATAR);
     if (!empty($_FILES['pic']['tmp_name'])) {
         $result = $upload->upfile('pic');
         if (!$result) {
             showMessage($upload->error, '', 'html', 'error');
         }
     } else {
         showMessage('upload failed', '', 'html', 'error');
     }
     self::profile_menu('member', 'avatar');
     Tpl::output('menu_sign', 'profile');
     Tpl::output('menu_sign_url', 'index.php?act=member&op=home');
     Tpl::output('menu_sign1', 'avatar');
     Tpl::output('newfile', $upload->thumb_image);
     Tpl::output('height', get_height(BASE_UPLOAD_PATH . '/' . ATTACH_AVATAR . '/' . $upload->thumb_image));
     Tpl::output('width', get_width(BASE_UPLOAD_PATH . '/' . ATTACH_AVATAR . '/' . $upload->thumb_image));
     Tpl::setLayout('member_pub_layout');
     Tpl::showpage('member_profile.avatar');
 }
开发者ID:noikiy,项目名称:shopnc-minion,代码行数:36,代码来源:home.php


示例4: uploadOp

 /**
  * POST 上传头像图片
  */
 public function uploadOp()
 {
     if (!isset($_POST)) {
         output_error("请求方式错误");
         die;
     }
     import('function.thumb');
     $member_id = $this->member_id;
     //上传图片
     $upload = new UploadFile();
     $upload->set('thumb_width', 500);
     $upload->set('thumb_height', 499);
     $ext = strtolower(pathinfo($_FILES['pic']['name'], PATHINFO_EXTENSION));
     $upload->set('file_name', "avatar_{$member_id}.{$ext}");
     $upload->set('thumb_ext', '_new');
     $upload->set('ifremove', true);
     $upload->set('default_dir', ATTACH_AVATAR);
     if (!empty($_FILES['pic']['tmp_name'])) {
         $result = $upload->upfile('pic');
         if (!$result) {
             output_error("上传失败");
             die;
         }
     } else {
         output_error('上传失败,请尝试更换图片格式或小图片');
         die;
     }
     $thumb_img = array('newfile' => $upload->thumb_image, 'height' => get_height(BASE_UPLOAD_PATH . '/' . ATTACH_AVATAR . '/' . $upload->thumb_image), 'width' => get_width(BASE_UPLOAD_PATH . '/' . ATTACH_AVATAR . '/' . $upload->thumb_image));
     output_data(array('avatar' => $upload->thumb_image));
 }
开发者ID:ff00x0,项目名称:shopnc-api,代码行数:33,代码来源:member_center.php


示例5: uploadOp

 /**
  * 上传头像
  */
 public function uploadOp()
 {
     if (!chksubmit()) {
         redirect('index.php?act=storesetting&op=avatar');
     }
     import('function.thumb');
     $store_id = $_SESSION['store_id'];
     //上传图片
     if (!empty($_FILES['uploadimg']['name'])) {
         $upload = new UploadFile();
         $uploaddir = ATTACH_MEMBER_PATH;
         $upload->set('thumb_width', 500);
         $upload->set('thumb_height', 499);
         $ext = strtolower(pathinfo($_FILES['uploadimg']['name'], PATHINFO_EXTENSION));
         $upload->set('file_name', "tmp_store_avatar_{$store_id}.{$ext}");
         $upload->set('thumb_ext', '_new');
         $upload->set('ifremove', true);
         $upload->set('default_dir', $uploaddir);
         $result = $upload->upfile('uploadimg');
         if ($result) {
             Tpl::output('newfile', $upload->thumb_image);
             Tpl::output('height', get_height(BASE_UPLOAD_PATH . '/shop/member/' . $upload->thumb_image));
             Tpl::output('width', get_width(BASE_UPLOAD_PATH . '/shop/member/' . $upload->thumb_image));
             Tpl::showpage('store.avatar');
         } else {
             $this->showTip('图片文件上传失败', '', 'html', 'error');
         }
     } else {
         $this->showTip('请选择要上传的头像图片文件', '', 'html', 'error');
     }
 }
开发者ID:noikiy,项目名称:shopnc-2,代码行数:34,代码来源:storesetting.php


示例6: setup_elements

    function setup_elements(&$mform)
    {
        global $CFG, $RESOURCE_WINDOW_OPTIONS;
        if (KalturaHelpers::getPlatformKey("partner_id", "none") == "none") {
            //        $basic = get_string('needreg', 'kaltura');
            //        $str = str_replace("##SERVER##", $CFG->wwwroot . "/admin/settings.php?section=modsettingkaltura", $basic);
            //        $mform->addElement('static', 'pleasereg',$str, '');
            redirect($CFG->wwwroot . "/admin/module.php?module=kaltura");
            die;
            //        return;
        }
        if (isset($_GET['update'])) {
            $item_id = $_GET['update'];
            $result = get_record('course_modules', 'id', $item_id);
            $result = get_record('resource', 'id', $result->instance);
            $entry = get_record('kaltura_entries', 'context', "R_" . "{$result->id}");
            $default_entry = $entry;
        } else {
            $last_entry_id = get_field('kaltura_entries', 'max(id)', 'id', 'id');
            if (!empty($last_entry_id)) {
                $default_entry = get_record('kaltura_entries', 'id', "{$last_entry_id}");
                $default_entry->title = "";
            } else {
                $default_entry = new kaltura_entry();
            }
        }
        $hidden_alltext = new HTML_QuickForm_hidden('alltext', $default_entry->dimensions, array('id' => 'id_alltext'));
        $mform->addElement($hidden_alltext);
        $hidden_popup = new HTML_QuickForm_hidden('popup', '', array('id' => 'id_popup'));
        $mform->addElement($hidden_popup);
        $hidden_dimensions = new HTML_QuickForm_hidden('dimensions', $default_entry->dimensions, array('id' => 'id_dimensions'));
        $mform->addElement($hidden_dimensions);
        $hidden_size = new HTML_QuickForm_hidden('size', $default_entry->size, array('id' => 'id_size'));
        $mform->addElement($hidden_size);
        $hidden_custom_width = new HTML_QuickForm_hidden('custom_width', $default_entry->custom_width, array('id' => 'id_custom_width'));
        $mform->addElement($hidden_custom_width);
        $hidden_design = new HTML_QuickForm_hidden('design', $default_entry->design, array('id' => 'id_design'));
        $mform->addElement($hidden_design);
        $hidden_title = new HTML_QuickForm_hidden('title', $default_entry->title, array('id' => 'id_title'));
        $mform->addElement($hidden_title);
        $hidden_entry_type = new HTML_QuickForm_hidden('entry_type', $default_entry->entry_type, array('id' => 'id_entry_type'));
        $mform->addElement($hidden_entry_type);
        $text_video = new HTML_QuickForm_static('video_text', null, '<span id="spanExplain"><table style="width:100%;font-size:9px;"><tr><td width="25%">' . get_string('videotext', 'resource_kalturavideo') . '</td><td style="width:40%;padding-left:25px;">' . get_string('videoremixtext', 'resource_kalturavideo') . '</td><td width="35%">&nbsp;</td></tr></table></span>');
        //   $text_video_remix = new HTML_QuickForm_static('video_text_remix',null, 'bbb');
        $button = new HTML_QuickForm_input();
        $button->setName('addvid');
        $button->setType('button');
        $button->setValue('Add Video');
        $button_editable = new HTML_QuickForm_input();
        $button_editable->setName('addeditvid');
        $button_editable->setType('button');
        $button_editable->setValue('Add Editable Video');
        $button_replace = new HTML_QuickForm_input();
        $button_replace->setName('replacevid');
        $button_replace->setType('button');
        $button_replace->setValue('Replace Video');
        $button_preview = new HTML_QuickForm_input();
        $button_preview->setName('previewvid');
        $button_preview->setType('button');
        $button_preview->setValue('Preview Video');
        $button_preview_edit = new HTML_QuickForm_input();
        $button_preview_edit->setName('previeweditvid');
        $button_preview_edit->setType('button');
        $button_preview_edit->setValue('Preview & Edit Video');
        $videolabel = get_string('addvideo', 'resource_kalturavideo');
        $videoeditablelabel = get_string('editablevideo', 'resource_kalturavideo');
        $replacelabel = get_string('replacevideo', 'resource_kalturavideo');
        $previewlabel = get_string('previewvideo', 'resource_kalturavideo');
        $previeweditlabel = get_string('previeweditvideo', 'resource_kalturavideo');
        $cw_url = $CFG->wwwroot . '/mod/kaltura/kcw.php?';
        $cw_url_init = $cw_url;
        $edit_url = $CFG->wwwroot . '/mod/kaltura/keditor.php?';
        $edit_url_init = $edit_url;
        $preview_url = $CFG->wwwroot . '/mod/kaltura/kpreview.php?';
        $preview_url_init = $preview_url;
        if (!empty($entry)) {
            $cw_url_init .= 'id=' . $entry->id;
            $preview_url_init .= 'entry_id=' . $entry->entry_id . '&design=' . $entry->design . '&width=' . get_width($entry) . '&dimensions=' . $entry->dimensions;
            $edit_url_init .= 'entry_id=' . $entry->entry_id;
        }
        $button_attributes = array('type' => 'button', 'onclick' => 'set_entry_type(' . KalturaEntryType::MEDIA_CLIP . ');kalturaInitModalBox(\'' . $cw_url_init . '&upload_type=video' . '\', {width:760, height:422});', 'id' => 'id_addvideo', 'value' => $videolabel, 'style' => empty($entry) ? 'display:inline' : 'display:none');
        $button_attributes_editable = array('type' => 'button', 'onclick' => 'set_entry_type(' . KalturaEntryType::MIX . ');kalturaInitModalBox(\'' . $cw_url_init . '&upload_type=mix' . '\', {width:760, height:422});', 'id' => 'id_addeditablevideo', 'value' => $videoeditablelabel, 'style' => empty($entry) ? 'display:inline;margin-left:90px;' : 'display:none');
        $button_attributes_replace = array('type' => 'button', 'onclick' => 'kalturaInitModalBox(\'' . $cw_url_init . (empty($entry) ? '' : ($entry->entry_type == KalturaEntryType::MEDIA_CLIP ? '&upload_type=video' : '&upload_type=mix')) . '\', {width:760, height:422});', 'id' => 'id_replace', 'value' => $replacelabel, 'style' => empty($entry) ? 'display:none' : 'display:inline');
        $button_attributes_preview = array('type' => 'button', 'onclick' => 'kalturaInitModalBox(\'' . $preview_url_init . '\', ' . (empty($entry) ? '{width:400, height:382}' : '{width:' . get_width($entry) . ', height:' . (get_height($entry) + 50) . '}') . ');', 'id' => 'id_preview', 'value' => $previewlabel, 'style' => empty($entry) || $entry->entry_type != KalturaEntryType::MEDIA_CLIP ? 'display:none' : 'display:inline');
        $button_attributes_preview_edit = array('type' => 'button', 'onclick' => 'kalturaInitModalBox(\'' . $edit_url_init . '\', {width:890, height:546});', 'id' => 'id_preview_edit', 'value' => $previeweditlabel, 'style' => empty($entry) || $entry->entry_type != KalturaEntryType::MIX ? 'display:none' : 'display:inline');
        $resource = $this->resource;
        $thumbnail = "";
        if (isset($_GET['update'])) {
            if (!empty($entry)) {
                $thumbnail = '<img id="id_thumb" src="' . KalturaHelpers::getThumbnailUrl(null, $entry->entry_id, 140, 105) . '" />';
                //	    $mform->addElement('static', 'video_thumb', get_string('video', 'resource_kalturavideo'), $thumbnail);
            }
        }
        $button->setAttributes($button_attributes);
        $button_editable->setAttributes($button_attributes_editable);
        $button_replace->setAttributes($button_attributes_replace);
        $button_preview->setAttributes($button_attributes_preview);
        $button_preview_edit->setAttributes($button_attributes_preview_edit);
        $objs = array();
        $objs[] =& $button;
//.........这里部分代码省略.........
开发者ID:hmatulis,项目名称:RTL-BIDI-Hebrew-Moodle-Plugins,代码行数:101,代码来源:resource.class.php


示例7: error_reporting

// Report all errors except E_NOTICE
// This is the default value set in php.ini
error_reporting(E_ALL ^ E_NOTICE);
$meta = '<link rel="stylesheet" type="text/css" href="' . $CFG->wwwroot . '/mod/kaltura/styles.php" />' . "\n";
//$meta = '<link rel="stylesheet" type="text/css" href="'.$CFG->wwwroot.'/mod/kaltura/css/kaltura.css" />'."\n";
print_header('Kaltura Preview', '', '', '', $meta);
$id = '';
if (isset($_GET['entry_id'])) {
    $id = $_GET['entry_id'];
}
if (empty($id)) {
    die('missing id');
}
if (isset($_GET['design'])) {
    $design = $_GET['design'];
} else {
    $design = 'light';
}
$entry = new kaltura_entry();
if (isset($_GET['width']) && isset($_GET['dimensions'])) {
    $entry->dimensions = $_GET['dimensions'];
    $entry->custom_width = $_GET['width'];
    $entry->size = KalturaPlayerSize::CUSTOM;
} else {
    $entry->dimensions = KalturaPlayerSize::LARGE;
    $entry->custom_width = 400;
    $entry->size = KalturaPlayerSize::CUSTOM;
}
echo embed_kaltura($id, get_width($entry), get_height($entry), KalturaEntryType::MEDIA_CLIP, $design);
echo '<div style="width:400px; margin-top:15px; text-align:center;"><input type="button"  value="' . get_string("close", "kaltura") . '" onclick="window.parent.kalturaCloseModalBox();" />';
print_footer();
开发者ID:hmatulis,项目名称:RTL-BIDI-Hebrew-Moodle-Plugins,代码行数:31,代码来源:kpreview.php


示例8: get_photos

function get_photos($post_id, $num = 0, $sizes = null, $ret = null, $landscape = null)
{
    // save the image with the highest priority
    // to use when returing only one image
    $top_priority['priority'] = 9999;
    // check if there are attachments
    if ($images = get_children(array('post_parent' => $post_id, 'post_type' => 'attachment', 'order' => 'ASC', 'orderby' => 'menu_order', 'post_mime_type' => 'image'))) {
        // loop through each image
        foreach ($images as $image) {
            $image->attachment_metadata = wp_get_attachment_metadata($image->ID);
            if (isset($photo['photos'])) {
                $i = count($photo['photos']);
            } else {
                $i = 0;
            }
            // store image information
            $photo['photos'][$i]['id'] = get_id($image);
            $photo['photos'][$i]['caption'] = get_caption($image);
            $photo['photos'][$i]['credit'] = get_credit($image);
            $photo['photos'][$i]['priority'] = get_priority($image);
            $photo['photos'][$i]['width'] = get_width($image);
            $photo['photos'][$i]['height'] = get_height($image);
            // return requested sizes
            if ($sizes) {
                foreach ($sizes as $size) {
                    $photo['photos'][$i]['src'][$size] = get_src($image, $size);
                }
            } else {
                // return all sizes when none are specified
                $photo['photos'][$i]['src']['full'] = get_src($image, 'full');
                $photo['photos'][$i]['src']['large'] = get_src($image, 'large');
                $photo['photos'][$i]['src']['thumbnail'] = get_src($image, 'thumbnail');
                $photo['photos'][$i]['src']['medium'] = get_src($image, 'medium');
                $photo['photos'][$i]['src']['single-inline'] = get_src($image, 'single-inline');
                $photo['photos'][$i]['src']['alt-thumbnail'] = get_src($image, 'alt-thumbnail');
                $photo['photos'][$i]['src']['custom-495'] = get_src($image, 'custom-495');
                $photo['photos'][$i]['src']['custom-165'] = get_src($image, 'custom-165');
                $photo['photos'][$i]['src']['custom-260'] = get_src($image, 'custom-260');
                $photo['photos'][$i]['src']['custom-75x75-crop'] = get_src($image, 'custom-75x75-crop');
            }
            // store the photo with the highest priority in wordpress.
            // photos with high priorities are given low numbers.
            // photos with priority of -1 are ignored.
            if ($num === 1 && $photo['photos'][$i]['priority'] < $top_priority['priority'] && $photo['photos'][$i]['priority'] >= 0) {
                // if user wants a landscape photo, check
                // to make sure it is landscape
                if ($landscape && !is_landscape($image)) {
                    continue;
                }
                $top_priority = $photo['photos'][$i];
            }
            // determine image position based on priority
            if (!isset($photo['display']['feature']) && get_priority($image) === 1) {
                // feature photo - below headline
                $photo['display']['feature'] = $i;
                $photo['photos'][$i]['src']['single-feature'] = get_src($image, 'single-feature');
            } elseif (!isset($photo['display']['inline']) && get_priority($image) === 2) {
                // inline photo - thumbnail w/in post
                $photo['display']['inline'] = $i;
                $photo['photos'][$i]['src']['single-inline'] = get_src($image, 'single-inline');
            } else {
                if (!isset($photo['display']['inline'])) {
                    // inline photo has not been set
                    $photo['display']['inline'] = $i;
                    $photo['photos'][$i]['src']['single-inline'] = get_src($image, 'single-inline');
                } else {
                    // gallery photo - appears in post photo gallery
                    if (isset($photo['display']['gallery'])) {
                        $photo['display']['gallery'][count($photo['display']['gallery'])] = $i;
                    } else {
                        $photo['display']['gallery'][0] = $i;
                    }
                }
            }
            // return first photo when one is requested and there is only one
            if ($num === 1 && count($images) == 1) {
                return $photo['photos'][$i];
            }
        }
        // returns top photo when one is requested.
        // if user only wants one landscape photo,
        // but the top_priority is not landscape, don't
        // return anything.
        if ($num === 1) {
            if ($landscape && !is_landscape($image)) {
                return false;
            }
            return $top_priority;
        }
        // return all of the requested photos
        return $photo;
    } else {
        // check if the image is from the archives. images on our old
        // websites (custom CMS for some time then College Publisher)
        // were not saved as attachments, but were stored as custom
        // fields.
        $meta = get_post_custom($post_id);
        if ($meta && isset($meta['_image1'])) {
            $meta['_image1'] = get_image($meta['_image1']);
            // needed to make legacy photo output look like current photos
//.........这里部分代码省略.........
开发者ID:wsander3,项目名称:Pipe-Dream,代码行数:101,代码来源:get-photos.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
PHP get_width_height函数代码示例发布时间:2022-05-15
下一篇:
PHP get_widget函数代码示例发布时间: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