예제 #1
0
<?php

if (preg_match('#' . basename(__FILE__) . '#', $_SERVER['PHP_SELF'])) {
    die('You are not allowed to call this page directly.');
}
$meta = new flagMeta($image->pid);
$dbdata = $meta->get_saved_meta();
$exifdata = $meta->get_EXIF();
$iptcdata = $meta->get_IPTC();
$xmpdata = $meta->get_XMP();
$alttext = trim($meta->get_META('title'));
$description = trim($meta->get_META('caption'));
$timestamp = $meta->get_date_time();
$makedescription = '<b>' . __('Meta Data', 'flash-album-gallery') . "</b><br>";
if ($dbdata) {
    foreach ($dbdata as $key => $value) {
        if (is_array($value)) {
            continue;
        }
        $makedescription .= '<b>' . $meta->i8n_name($key) . "</b> " . $value . "<br>";
    }
} else {
    $makedescription .= __('No meta data saved', 'flash-album-gallery') . "<br>";
}
if ($exifdata) {
    $makedescription .= "\n<b>" . __('EXIF Data', 'flash-album-gallery') . "</b><br>";
    foreach ($exifdata as $key => $value) {
        $makedescription .= '<b>' . $meta->i8n_name($key) . "</b> " . $value . "<br>";
    }
}
if ($iptcdata) {
예제 #2
0
파일: functions.php 프로젝트: recca004/JAS
 /**
  * flagAdmin::get_MetaData()
  *
  * @class flagAdmin
  * @require Meta class
  * @param $id
  * @return array metadata
  */
 function get_MetaData($id)
 {
     require_once FLAG_ABSPATH . 'lib/meta.php';
     $meta = array();
     $pdata = new flagMeta($id);
     $meta['title'] = trim($pdata->get_META('title'));
     $meta['caption'] = trim($pdata->get_META('caption'));
     $meta['keywords'] = trim($pdata->get_META('keywords'));
     $meta['timestamp'] = $pdata->get_date_time();
     // this contain other useful meta information
     $meta['common'] = $pdata->get_common_meta();
     return $meta;
 }
 function ewww_manage_image_custom_column($column_name, $id)
 {
     // check to make sure we're outputing our custom column
     if ($column_name == 'ewww_image_optimizer') {
         // get the metadata
         $meta = new flagMeta($id);
         // grab the image status from the meta
         $status = $meta->get_META('ewww_image_optimizer');
         $msg = '';
         // get the image path from the meta
         $file_path = $meta->image->imagePath;
         // get the mimetype
         $type = ewww_image_optimizer_mimetype($file_path, 'i');
         // get the file size
         $file_size = ewww_image_optimizer_format_bytes(filesize($file_path));
         $valid = true;
         // if we don't have a valid tool for the image type, output the appropriate message
         switch ($type) {
             case 'image/jpeg':
                 if (EWWW_IMAGE_OPTIMIZER_JPEGTRAN == false) {
                     $valid = false;
                     $msg = '<br>' . __('<em>jpegtran</em> is missing');
                 }
                 break;
             case 'image/png':
                 if (EWWW_IMAGE_OPTIMIZER_PNGOUT == false && EWWW_IMAGE_OPTIMIZER_OPTIPNG == false) {
                     $valid = false;
                     $msg = '<br>' . __('<em>optipng/pngout</em> is missing');
                 }
                 break;
             case 'image/gif':
                 if (EWWW_IMAGE_OPTIMIZER_GIFSICLE == false) {
                     $valid = false;
                     $msg = '<br>' . __('<em>gifsicle</em> is missing');
                 }
                 break;
             default:
                 $valid = false;
         }
         // let user know if the file type is unsupported
         if ($valid == false) {
             print __('Unsupported file type', EWWW_IMAGE_OPTIMIZER_DOMAIN) . $msg;
             return;
         }
         // output the image status if we know it
         if (!empty($status)) {
             echo $status;
             print "<br>Image Size: {$file_size}";
             printf("<br><a href=\"admin.php?action=ewww_flag_manual&amp;attachment_ID=%d\">%s</a>", $id, __('Re-optimize', EWWW_IMAGE_OPTIMIZER_DOMAIN));
             // otherwise, tell the user that they can optimize the image now
         } else {
             print __('Not processed', EWWW_IMAGE_OPTIMIZER_DOMAIN);
             print "<br>Image Size: {$file_size}";
             printf("<br><a href=\"admin.php?action=ewww_flag_manual&amp;attachment_ID=%d\">%s</a>", $id, __('Optimize now!', EWWW_IMAGE_OPTIMIZER_DOMAIN));
         }
     }
 }