當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。