本文整理汇总了PHP中nggAdmin::maybe_import_meta方法的典型用法代码示例。如果您正苦于以下问题:PHP nggAdmin::maybe_import_meta方法的具体用法?PHP nggAdmin::maybe_import_meta怎么用?PHP nggAdmin::maybe_import_meta使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类nggAdmin
的用法示例。
在下文中一共展示了nggAdmin::maybe_import_meta方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: set_watermark
/**
* nggAdmin::set_watermark() - set the watermark for the image
*
* @class nggAdmin
* @param object | int $image contain all information about the image or the id
* @return string result code
*/
function set_watermark($image)
{
global $ngg;
if (!class_exists('ngg_Thumbnail')) {
require_once nggGallery::graphic_library();
}
if (is_numeric($image)) {
$image = nggdb::find_image($image);
}
if (!is_object($image)) {
return __('Object didn\'t contain correct data', 'nggallery');
}
// before we start we import the meta data to database (required for uploads before V1.4.0)
nggAdmin::maybe_import_meta($image->pid);
if (!is_writable($image->imagePath)) {
return ' <strong>' . $image->filename . __(' is not writeable', 'nggallery') . '</strong>';
}
$file = new ngg_Thumbnail($image->imagePath, TRUE);
// skip if file is not there
if (!$file->error) {
// If required save a backup copy of the file
if ($ngg->options['imgBackup'] == 1 && !file_exists($image->imagePath . '_backup')) {
@copy($image->imagePath, $image->imagePath . '_backup');
}
if ($ngg->options['wmType'] == 'image') {
$file->watermarkImgPath = $ngg->options['wmPath'];
$file->watermarkImage($ngg->options['wmPos'], $ngg->options['wmXpos'], $ngg->options['wmYpos']);
}
if ($ngg->options['wmType'] == 'text') {
$file->watermarkText = $ngg->options['wmText'];
$file->watermarkCreateText($ngg->options['wmColor'], $ngg->options['wmFont'], $ngg->options['wmSize'], $ngg->options['wmOpaque']);
$file->watermarkImage($ngg->options['wmPos'], $ngg->options['wmXpos'], $ngg->options['wmYpos']);
}
$file->save($image->imagePath, $ngg->options['imgQuality']);
}
$file->destruct();
if (!empty($file->errmsg)) {
return ' <strong>' . $image->filename . ' (Error : ' . $file->errmsg . ')</strong>';
}
return '1';
}