本文整理匯總了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';
}