当前位置: 首页>>代码示例>>PHP>>正文


PHP stdClass::Image方法代码示例

本文整理汇总了PHP中stdClass::Image方法的典型用法代码示例。如果您正苦于以下问题:PHP stdClass::Image方法的具体用法?PHP stdClass::Image怎么用?PHP stdClass::Image使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在stdClass的用法示例。


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

示例1: print_signature

/**
 * Prints signature images or a line.
 *
 * @param stdClass $pdf
 * @param stdClass $certificate
 * @param int $x x position
 * @param int $y y position
 * @param int $w the width
 * @param int $h the height
 * @return null
 */
function print_signature($pdf, $certificate, $x, $y, $w, $h)
{
    global $CFG, $DB;
    switch ($certificate->printsignature) {
        case '0':
        case '':
            break;
        default:
            if (file_exists("{$CFG->dirroot}/mod/certificate/pix/signatures/{$certificate->printsignature}")) {
                $pdf->Image("{$CFG->dirroot}/mod/certificate/pix/signatures/{$certificate->printsignature}", $x, $y, $w, $h);
            }
            break;
    }
}
开发者ID:noisyjerm,项目名称:moodle-mod_certificate,代码行数:25,代码来源:lib.php

示例2: certificate_print_image

/**
 * Prints border images from the borders folder in PNG or JPG formats.
 *
 * @param stdClass $pdf
 * @param stdClass $certificate
 * @param string $type the type of image
 * @param int $x x position
 * @param int $y y position
 * @param int $w the width
 * @param int $h the height
 */
function certificate_print_image($pdf, $certificate, $type, $x, $y, $w, $h)
{
    global $CFG;
    switch ($type) {
        case CERT_IMAGE_BORDER:
            $attr = 'borderstyle';
            $path = "{$CFG->dirroot}/mod/certificate/pix/{$type}/{$certificate->borderstyle}";
            $uploadpath = "{$CFG->dataroot}/mod/certificate/pix/{$type}/{$certificate->borderstyle}";
            break;
        case CERT_IMAGE_SEAL:
            $attr = 'printseal';
            $path = "{$CFG->dirroot}/mod/certificate/pix/{$type}/{$certificate->printseal}";
            $uploadpath = "{$CFG->dataroot}/mod/certificate/pix/{$type}/{$certificate->printseal}";
            break;
        case CERT_IMAGE_SIGNATURE:
            $attr = 'printsignature';
            $path = "{$CFG->dirroot}/mod/certificate/pix/{$type}/{$certificate->printsignature}";
            $uploadpath = "{$CFG->dataroot}/mod/certificate/pix/{$type}/{$certificate->printsignature}";
            break;
        case CERT_IMAGE_WATERMARK:
            $attr = 'printwmark';
            $path = "{$CFG->dirroot}/mod/certificate/pix/{$type}/{$certificate->printwmark}";
            $uploadpath = "{$CFG->dataroot}/mod/certificate/pix/{$type}/{$certificate->printwmark}";
            break;
    }
    // Has to be valid
    if (!empty($path)) {
        switch ($certificate->{$attr}) {
            case '0':
            case '':
                break;
            default:
                if (file_exists($path)) {
                    $pdf->Image($path, $x, $y, $w, $h);
                }
                if (file_exists($uploadpath)) {
                    $pdf->Image($uploadpath, $x, $y, $w, $h);
                }
                break;
        }
    }
}
开发者ID:ccle,项目名称:moodle-mod_certificate,代码行数:53,代码来源:locallib.php


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