コード例 #1
0
ファイル: showmeta.php プロジェクト: recca004/JAS
<?php

// look up for the path
require_once dirname(dirname(__FILE__)) . '/flag-config.php';
require_once FLAG_ABSPATH . '/lib/meta.php';
require_once FLAG_ABSPATH . '/lib/image.php';
if (!is_user_logged_in()) {
    die(__('Cheatin&#8217; uh?'));
}
if (!current_user_can('FlAG Manage gallery')) {
    die(__('Cheatin&#8217; uh?'));
}
global $wpdb;
$id = (int) $_GET['id'];
// let's get the meta data'
$meta = new flagMeta($id);
$dbdata = $meta->get_saved_meta();
$exifdata = $meta->get_EXIF();
$iptcdata = $meta->get_IPTC();
$xmpdata = $meta->get_XMP();
?>

	<!-- META DATA -->
	<fieldset class="options flag">
	<h3><?php 
_e('Meta Data', 'flag');
?>
</h3>
	<?php 
if ($dbdata) {
    ?>
コード例 #2
0
ファイル: functions.php プロジェクト: recca004/JAS
 /**
  * Maybe import some meta data to the database. The functions checks the flag 'saved'
  * and if based on compat reason (pre V0.40) we save then some meta datas to the database
  * 
  * @param int $id
  * @return mixed  result
  */
 function maybe_import_meta($id)
 {
     require_once FLAG_ABSPATH . 'lib/meta.php';
     $meta_obj = new flagMeta($id);
     if ($meta_obj->image->meta_data['saved'] != true) {
         $common = $meta_obj->get_common_meta();
         //this flag will inform us that the import is already one time performed
         $common['saved'] = true;
         $result = flagdb::update_image_meta($id, $common);
     } else {
         return false;
     }
     return $result;
 }
コード例 #3
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) {
コード例 #4
0
ファイル: upgrade.php プロジェクト: recca004/JAS
/**
 * flag_import_date_time() - Read the timestamp from exif and insert it into the database
 * 
 * @return void
 */
function flag_import_date_time()
{
    global $wpdb;
    $imagelist = $wpdb->get_results("SELECT t.*, tt.* FROM {$wpdb->flaggallery} AS t INNER JOIN {$wpdb->flagpictures} AS tt ON t.gid = tt.galleryid ORDER BY tt.pid ASC");
    if (is_array($imagelist)) {
        foreach ($imagelist as $image) {
            $picture = new flagImage($image);
            $meta = new flagMeta($picture->imagePath, true);
            $date = $meta->get_date_time();
            $wpdb->query($wpdb->prepare("UPDATE {$wpdb->flagpictures} SET imagedate = '%s' WHERE pid = '%d'", $date, $picture->pid));
        }
    }
}
コード例 #5
0
 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));
         }
     }
 }