本文整理汇总了PHP中wppa_get_photo_path函数的典型用法代码示例。如果您正苦于以下问题:PHP wppa_get_photo_path函数的具体用法?PHP wppa_get_photo_path怎么用?PHP wppa_get_photo_path使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wppa_get_photo_path函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: wppa_upload_to_cloudinary
function wppa_upload_to_cloudinary($id)
{
$prefix = is_multisite() && !WPPA_MULTISITE_GLOBAL ? $blog_id . '-' : '';
$pub_id = $prefix . $id;
$file = wppa_get_photo_path($id);
$args = array("public_id" => $pub_id, "version" => get_option('wppa_photo_version', '1'), "invalidate" => true);
if (file_exists($file)) {
\Cloudinary\Uploader::upload($file, $args);
}
}
开发者ID:billadams,项目名称:forever-frame,代码行数:10,代码来源:wppa-cloudinary.php
示例2: wppa_upload_to_cloudinary
function wppa_upload_to_cloudinary($id)
{
$prefix = is_multisite() && !WPPA_MULTISITE_GLOBAL ? $blog_id . '-' : '';
$args = array("public_id" => $prefix . $id, "version" => get_option('wppa_photo_version', '1'), "invalidate" => true);
// Try source first
$file = wppa_get_source_path($id);
// No source, use photofile
if (!is_file($file)) {
$file = wppa_get_photo_path($id);
}
// Doit
if (is_file($file)) {
\Cloudinary\Uploader::upload($file, $args);
}
}
开发者ID:msayagh,项目名称:Quercus-source-code-Maven,代码行数:15,代码来源:wppa-cloudinary.php
示例3: wppa_get_poster_ext
function wppa_get_poster_ext($id)
{
global $wppa_supported_photo_extensions;
// Init
$path = wppa_get_photo_path($id);
$raw_path = wppa_strip_ext($path);
// Find existing photofiles
foreach ($wppa_supported_photo_extensions as $ext) {
if (is_file($raw_path . '.' . $ext)) {
return $ext;
// Found !
}
}
// Not found.
return false;
}
开发者ID:uwmadisoncals,项目名称:Cluster-Plugins,代码行数:16,代码来源:wppa-utils.php
示例4: wppa_rotate
function wppa_rotate($id, $ang)
{
global $wpdb;
// Check args
$err = '1';
if (!is_numeric($id) || !is_numeric($ang)) {
return $err;
}
// Get the ext
$err = '2';
$ext = $wpdb->get_var($wpdb->prepare('SELECT ext FROM ' . WPPA_PHOTOS . ' WHERE id = %s', $id));
if (!$ext) {
return $err;
}
// Get the image
$err = '3';
$file = wppa_get_photo_path($id);
if (!is_file($file)) {
return $err;
}
// Get the imgdetails
$err = '4';
$img = getimagesize($file);
if (!$img) {
return $err;
}
// Get the image
switch ($img[2]) {
case 1:
// gif
$err = '5';
$source = imagecreatefromgif($file);
break;
case 2:
// jpg
$err = '6';
$source = imagecreatefromjpeg($file);
break;
case 3:
// png
$err = '7';
$source = imagecreatefrompng($file);
break;
default:
// unsupported mimetype
$err = '10';
$source = false;
}
if (!$source) {
return $err;
}
// Rotate the image
$err = '11';
$rotate = imagerotate($source, $ang, 0);
if (!$rotate) {
return $err;
}
// Save the image
switch ($img[2]) {
case 1:
$err = '15';
$bret = imagegif($rotate, $file, 95);
break;
case 2:
$err = '16';
$bret = imagejpeg($rotate, $file);
break;
case 3:
$err = '17';
$bret = imagepng($rotate, $file);
break;
default:
$err = '20';
$bret = false;
}
if (!$bret) {
return $err;
}
// Destroy the source
imagedestroy($source);
// Destroy the result
imagedestroy($rotate);
// Clear stored dimensions
wppa_update_photo(array('id' => $id, 'thumbx' => '0', 'thumby' => '0', 'photox' => '0', 'photoy' => '0'));
$err = '30';
// Recreate the thumbnail, do NOT use source: source can not be rotated
$bret = wppa_create_thumbnail($id, false);
if (!$bret) {
return $err;
}
// Return success
return false;
}
开发者ID:msayagh,项目名称:Quercus-source-code-Maven,代码行数:93,代码来源:wppa-admin-functions.php
示例5: wppa_recuperate
function wppa_recuperate($id)
{
global $thumb;
global $wpdb;
wppa_cache_thumb($id);
$iptcfix = false;
$exiffix = false;
$file = wppa_get_source_path($id);
if (!is_file($file)) {
$file = wppa_get_photo_path($id);
}
if (is_file($file)) {
// Not a dir
$attr = getimagesize($file, $info);
if (is_array($attr)) {
// Is a picturefile
if ($attr[2] == IMAGETYPE_JPEG) {
// Is a jpg
if (wppa_switch('wppa_save_iptc')) {
// Save iptc
if (isset($info["APP13"])) {
// There is IPTC data
$is_iptc = $wpdb->get_var($wpdb->prepare("SELECT COUNT(*) FROM `" . WPPA_IPTC . "` WHERE `photo` = %s", $id));
if (!$is_iptc) {
// No IPTC yet and there is: Recuperate
wppa_import_iptc($id, $info, 'nodelete');
$iptcfix = true;
}
}
}
if (wppa_switch('wppa_save_exif')) {
// Save exif
$image_type = exif_imagetype($file);
if ($image_type == IMAGETYPE_JPEG) {
// EXIF supported by server
$is_exif = $wpdb->get_var($wpdb->prepare("SELECT COUNT(*) FROM `" . WPPA_EXIF . "` WHERE `photo`=%s", $id));
if (!$is_exif) {
// No EXIF yet
$exif = @exif_read_data($file, 'EXIF');
//@
if (is_array($exif)) {
// There is exif data present
wppa_import_exif($id, $file, 'nodelete');
$exiffix = true;
}
}
}
}
}
}
}
return array('iptcfix' => $iptcfix, 'exiffix' => $exiffix);
}
开发者ID:billadams,项目名称:forever-frame,代码行数:53,代码来源:wppa-maintenance.php
示例6: wppa_import_photos
//.........这里部分代码省略.........
if (in_array($ext, $wppa_supported_photo_extensions)) {
// See if a metafile exists
//$meta = substr( $file, 0, strlen( $file ) - 3 ).'pmf';
$meta = wppa_strip_ext($unsanitized_path_name) . '.PMF';
if (!is_file($meta)) {
$meta = wppa_strip_ext($unsanitized_path_name) . '.pmf';
}
// find all data: name, desc, porder form metafile
if (is_file($meta)) {
$alb = wppa_get_album_id(wppa_get_meta_album($meta));
$name = wppa_get_meta_name($meta);
$desc = wppa_txt_to_nl(wppa_get_meta_desc($meta));
$porder = wppa_get_meta_porder($meta);
$linkurl = wppa_get_meta_linkurl($meta);
$linktitle = wppa_get_meta_linktitle($meta);
} else {
$alb = $album;
// default album
$name = '';
// default name
$desc = '';
// default description
$porder = '0';
// default p_order
$linkurl = '';
$linktitle = '';
}
// If there is a video or audio with the same name, this is the poster.
$is_poster = wppa_file_is_in_album(wppa_strip_ext(basename($file)) . '.xxx', $alb);
if ($is_poster) {
// Delete possible poster sourcefile
wppa_delete_source(basename($file), $alb);
// Remove possible existing posters, the file-extension may be different as before
$old_photo = wppa_strip_ext(wppa_get_photo_path($is_poster));
$old_thumb = wppa_strip_ext(wppa_get_thumb_path($is_poster));
foreach ($wppa_supported_photo_extensions as $pext) {
if (is_file($old_photo . '.' . $pext)) {
unlink($old_photo . '.' . $pext);
}
if (is_file($old_thumb . '.' . $pext)) {
unlink($old_thumb . '.' . $pext);
}
}
// Clear sizes on db
wppa_update_photo(array('thumbx' => '0', 'thumby' => '0', 'photox' => '0', 'photoy' => '0'));
// Make new files
$bret = wppa_make_the_photo_files($file, $is_poster, strtolower(wppa_get_ext(basename($file))));
if ($bret) {
// Success
if (wppa('ajax')) {
wppa('ajax_import_files_done', true);
}
wppa_save_source($file, basename($file), $alb);
wppa_make_o1_source($is_poster);
$pcount++;
$totpcount += $bret;
if ($delp) {
unlink($file);
}
} else {
// Failed
if (!wppa('ajax')) {
wppa_error_message('Failed to add poster for item ' . $is_poster);
}
if ($delf) {
unlink($file);
开发者ID:uwmadisoncals,项目名称:Cluster-Plugins,代码行数:67,代码来源:wppa-import.php
示例7: wppa_album_photos
//.........这里部分代码省略.........
} elseif ($status == 'featured') {
_e('Featured', 'wp-photo-album-plus');
} elseif ($status == 'gold') {
_e('Gold', 'wp-photo-album-plus');
} elseif ($status == 'silver') {
_e('Silver', 'wp-photo-album-plus');
} elseif ($status == 'bronze') {
_e('Bronze', 'wp-photo-album-plus');
} elseif ($status == 'scheduled') {
_e('Scheduled', 'wp-photo-album-plus');
} elseif ($status == 'private') {
_e('Private', 'wp-photo-album-plus');
}
echo wppa_get_date_time_select_html('photo', $id, false) . '<span id="psdesc-' . $id . '" class="description" style="display:none;" >' . __('Note: Featured photos should have a descriptive name; a name a search engine will look for!', 'wp-photo-album-plus') . '</span>';
}
echo ' ';
// Update status field
echo __('Remark:', 'wp-photo-album-plus') . ' ' . '<span' . ' id="photostatus-' . $id . '"' . ' style="font-weight:bold;color:#00AA00;"' . ' >' . ($is_video ? sprintf(__('Video %s is not modified yet', 'wp-photo-album-plus'), $id) : sprintf(__('Photo %s is not modified yet', 'wp-photo-album-plus'), $id)) . '</span>';
// New Line
echo '<br />';
// --- Available files ---
echo __('Available files:', 'wp-photo-album-plus') . ' ';
// Source
echo __('Source file:', 'wp-photo-album-plus') . ' ';
$sp = wppa_get_source_path($id);
if (is_file($sp)) {
$ima = getimagesize($sp);
echo $ima['0'] . ' x ' . $ima['1'] . ' px, ' . wppa_get_filesize($sp) . '. ';
} else {
echo __('Unavailable', 'wp-photo-album-plus') . '. ';
}
// Display
echo ($is_video || $has_audio ? __('Poster file:', 'wp-photo-album-plus') : __('Display file:', 'wp-photo-album-plus')) . ' ';
$dp = wppa_fix_poster_ext(wppa_get_photo_path($id), $id);
if (is_file($dp)) {
echo floor(wppa_get_photox($id)) . ' x ' . floor(wppa_get_photoy($id)) . ' px, ' . wppa_get_filesize($dp) . '. ';
} else {
echo '<span style="color:red;" >' . __('Unavailable', 'wp-photo-album-plus') . '. ' . '</span>';
}
// Thumbnail
if (!$is_video) {
echo __('Thumbnail file:', 'wp-photo-album-plus') . ' ';
$tp = wppa_fix_poster_ext(wppa_get_thumb_path($id), $id);
if (is_file($tp)) {
echo floor(wppa_get_thumbx($id)) . ' x ' . floor(wppa_get_thumby($id)) . ' px, ' . wppa_get_filesize($tp) . '. ';
} else {
echo '<span style="color:red;" >' . __('Unavailable', 'wp-photo-album-plus') . '. ' . '</span>';
}
}
// New line
echo '<br />';
// Video
if ($b_is_video) {
echo __('Video size:', 'wp-photo-album-plus') . ' ' . __('Width:', 'wp-photo-album-plus') . '<input' . ' style="width:50px;margin:0 4px;"' . ' onkeyup="wppaAjaxUpdatePhoto( ' . $id . ', \'videox\', this )"' . ' onchange="wppaAjaxUpdatePhoto( ' . $id . ', \'videox\', this )"' . ' value="' . $videox . '"' . ' />' . sprintf(__('pix, (0=default:%s)', 'wp-photo-album-plus'), wppa_opt('video_width')) . __('Height:', 'wp-photo-album-plus') . '<input' . ' style="width:50px;margin:0 4px;"' . ' onkeyup="wppaAjaxUpdatePhoto( ' . $id . ', \'videoy\', this )"' . ' onchange="wppaAjaxUpdatePhoto( ' . $id . ', \'videoy\', this )"' . ' value="' . $videoy . '"' . ' />' . sprintf(__('pix, (0=default:%s)', 'wp-photo-album-plus'), wppa_opt('video_height')) . ' ' . __('Formats:', 'wp-photo-album-plus') . ' ';
$c = 0;
foreach ($is_video as $fmt) {
echo $fmt . ' ' . __('Filesize:', 'wp-photo-album-plus') . ' ' . wppa_get_filesize(str_replace('xxx', $fmt, wppa_get_photo_path($id)));
$c++;
if ($c == count($is_video)) {
echo '. ';
} else {
echo ', ';
}
}
}
// Audio
开发者ID:uwmadisoncals,项目名称:Cluster-Plugins,代码行数:67,代码来源:wppa-photo-admin-autosave.php
示例8: wppa_copy_audio_files
function wppa_copy_audio_files($fromid, $toid)
{
global $wppa_supported_audio_extensions;
// Is it an audio?
if (!wppa_has_audio($fromid)) {
return false;
}
// Get paths
$from_path = wppa_get_photo_path($fromid);
$raw_from_path = wppa_strip_ext($from_path);
$to_path = wppa_get_photo_path($toid);
$raw_to_path = wppa_strip_ext($to_path);
// Copy the media files
foreach ($wppa_supported_audio_extensions as $ext) {
$file = $raw_from_path . '.' . $ext;
if (is_file($file)) {
if (!copy($file, $raw_to_path . '.' . $ext)) {
return false;
}
}
}
/*
// Copy the poster file
$poster = wppa_fix_poster_ext( $from_path, $fromid );
if ( is_file( $poster ) ) {
if ( ! copy( $poster, $raw_to_path . '.' . wppa_get_ext( $from_path ) ) ) return false;
}
// Copy the poster thumb
$poster_thumb = wppa_fix_poster_ext( wppa_get_thumb_path( $fromid ) );
$poster_thumb_to = wppa_strip_ext( wppa_get_thumb_path( $toid ) ) . '.' . wppa_get_ext( $poster_thumb );
if ( is_file( $poster_thumb ) ) {
if ( ! copy( $poster_thumb, $poster_thumb_to ) ) return false;
}
*/
// Done!
return true;
}
开发者ID:msayagh,项目名称:Quercus-source-code-Maven,代码行数:38,代码来源:wppa-audio.php
示例9: wppa_ajax_callback
//.........这里部分代码省略.........
if (!$photos) {
echo '||ER||' . __('The album is empty', 'wp-photo-album-plus');
wppa_exit();
}
// Remove obsolete files
wppa_delete_obsolete_tempfiles();
// Open zipfile
if (!class_exists('ZipArchive')) {
echo '||ER||' . __('Unable to create zip archive', 'wp-photo-album-plus');
wppa_exit();
}
$zipfilename = wppa_get_album_name($alb);
$zipfilename = wppa_sanitize_file_name($zipfilename . '.zip');
// Remove illegal chars
$zipfilepath = WPPA_UPLOAD_PATH . '/temp/' . $zipfilename;
if (is_file($zipfilepath)) {
// unlink( $zipfilepath ); // Debug
}
$wppa_zip = new ZipArchive();
$iret = $wppa_zip->open($zipfilepath, 1);
if ($iret !== true) {
echo '||ER||' . sprintf(__('Unable to create zip archive. code = %s', 'wp-photo-album-plus'), $iret);
wppa_exit();
}
// Add photos to zip
$stop = false;
foreach ($photos as $p) {
if (wppa_is_time_up()) {
wppa_log('obs', 'Time up during album to zip creation');
$stop = true;
} else {
$id = $p['id'];
if (!wppa_is_multi($id)) {
$source = wppa_switch('download_album_source') && is_file(wppa_get_source_path($id)) ? wppa_get_source_path($id) : wppa_get_photo_path($id);
if (is_file($source)) {
$dest = $p['filename'] ? wppa_sanitize_file_name($p['filename']) : wppa_sanitize_file_name(wppa_strip_ext($p['name']) . '.' . $p['ext']);
$dest = wppa_fix_poster_ext($dest, $id);
$iret = $wppa_zip->addFile($source, $dest);
// To prevent too may files open, and to have at least a file when there are too many photos, close and re-open
$wppa_zip->close();
$wppa_zip->open($zipfilepath);
// wppa_log( 'dbg', 'Added ' . basename($source) . ' to ' . basename($zipfilepath));
}
}
}
if ($stop) {
break;
}
}
// Close zip and return
$zipcount = $wppa_zip->numFiles;
$wppa_zip->close();
// A zip is created
$desturl = WPPA_UPLOAD_URL . '/temp/' . $zipfilename;
echo $desturl . '||OK||';
if ($zipcount != count($photos)) {
echo sprintf(__('Only %s out of %s photos could be added to the zipfile', 'wp-photo-album-plus'), $zipcount, count($photos));
}
wppa_exit();
break;
case 'getalbumzipurl':
$alb = $_REQUEST['album-id'];
$zipfilename = wppa_get_album_name($alb);
$zipfilename = wppa_sanitize_file_name($zipfilename . '.zip');
// Remove illegal chars
$zipfilepath = WPPA_UPLOAD_PATH . '/temp/' . $zipfilename;
开发者ID:msayagh,项目名称:Quercus-source-code-Maven,代码行数:67,代码来源:wppa-ajax.php
示例10: wppa_get_fullimgstyle_a
function wppa_get_fullimgstyle_a($id)
{
global $wppa;
if (!is_numeric($wppa['fullsize']) || $wppa['fullsize'] <= '1') {
$wppa['fullsize'] = wppa_opt('wppa_fullsize');
}
$wppa['enlarge'] = wppa_switch('wppa_enlarge');
return wppa_get_imgstyle_a($id, wppa_get_photo_path($id), $wppa['fullsize'], 'optional', 'fullsize');
}
开发者ID:billadams,项目名称:forever-frame,代码行数:9,代码来源:wppa-styles.php
示例11: wppa_export_photos
function wppa_export_photos()
{
global $wpdb;
global $wppa_zip;
global $wppa_temp;
global $wppa_temp_idx;
$wppa_temp_idx = 0;
_e('Exporting...<br/>', 'wp-photo-album-plus');
if (PHP_VERSION_ID >= 50207 && class_exists('ZipArchive')) {
echo 'Opening zip output file...';
$wppa_zip = new ZipArchive();
$zipid = get_option('wppa_last_zip', '0');
$zipid++;
update_option('wppa_last_zip', $zipid);
$zipfile = WPPA_DEPOT_PATH . '/wppa-' . $zipid . '.zip';
if ($wppa_zip->open($zipfile, 1) === TRUE) {
_e('ok, <br/>Filling', 'wp-photo-album-plus');
echo ' ' . basename($zipfile);
} else {
_e('failed<br/>', 'wp-photo-album-plus');
$wppa_zip = false;
}
} else {
$wppa_zip = false;
if (PHP_VERSION_ID < 50207) {
wppa_warning_message(__('Can export albums and photos, but cannot make a zipfile. Your php version is < 5.2.7.', 'wp-photo-album-plus'));
}
if (!class_exists('ZipArchive')) {
wppa_warning_message(__('Can export albums and photos, but cannot make a zipfile. Your php version does not support ZipArchive.', 'wp-photo-album-plus'));
}
}
if (isset($_POST['high'])) {
$high = $_POST['high'];
} else {
$high = 0;
}
if ($high) {
$id = 0;
$cnt = 0;
while ($id <= $high) {
if (isset($_POST['album-' . $id])) {
_e('<br/>Processing album', 'wp-photo-album-plus');
echo ' ' . $id . '....';
wppa_write_album_file_by_id($id);
$photos = $wpdb->get_results($wpdb->prepare('SELECT * FROM ' . WPPA_PHOTOS . ' WHERE album = %s', $id), 'ARRAY_A');
$cnt = 0;
foreach ($photos as $photo) {
// Copy the photo
$from = wppa_get_photo_path($photo['id']);
$to = WPPA_DEPOT_PATH . '/' . $photo['id'] . '.' . $photo['ext'];
if ($wppa_zip) {
$wppa_zip->addFile($from, basename($to));
} else {
copy($from, $to);
}
// Create the metadata
if (!wppa_write_photo_file($photo)) {
return false;
} else {
$cnt++;
}
}
_e('done.', 'wp-photo-album-plus');
echo ' ' . $cnt . ' ';
_e('photos processed.', 'wp-photo-album-plus');
}
$id++;
}
_e('<br/>Done export albums.', 'wp-photo-album-plus');
} else {
_e('Nothing to export', 'wp-photo-album-plus');
}
if ($wppa_zip) {
_e('<br/>Closing zip.', 'wp-photo-album-plus');
_e('<br/>Deleting temp files.', 'wp-photo-album-plus');
$wppa_zip->close();
// Now the zip is closed we can destroy all tempfiles we created here
if (is_array($wppa_temp)) {
foreach ($wppa_temp as $file) {
unlink($file);
}
}
}
_e('<br/>Done!', 'wp-photo-album-plus');
}
开发者ID:msayagh,项目名称:Quercus-source-code-Maven,代码行数:85,代码来源:wppa-export.php
示例12: wppa_add_watermark
function wppa_add_watermark($id)
{
// Init
if (!wppa_switch('wppa_watermark_on')) {
return false;
}
// Watermarks off
// if ( wppa_is_video( $id ) ) return false; // Can not on a video
// Find the watermark file and location
$temp = wppa_get_water_file_and_pos($id);
$waterfile = $temp['file'];
if (!$waterfile) {
return false;
}
// an error has occurred
$waterpos = $temp['pos'];
// default
if (basename($waterfile) == '--- none ---') {
return false;
// No watermark this time
}
// Open the watermark file
$watersize = @getimagesize($waterfile);
if (!is_array($watersize)) {
return false;
}
// Not a valid picture file
$waterimage = imagecreatefrompng($waterfile);
if (empty($waterimage) or !$waterimage) {
wppa_dbg_msg('Watermark file ' . $waterfile . ' not found or corrupt');
return false;
// No image
}
imagealphablending($waterimage, false);
imagesavealpha($waterimage, true);
// Open the photo file
$file = wppa_get_photo_path($id);
if (wppa_is_video($id)) {
$file = wppa_fix_poster_ext($file, $id);
}
if (!is_file($file)) {
return false;
}
// File gone
$photosize = getimagesize($file);
if (!is_array($photosize)) {
return false;
// Not a valid photo
}
switch ($photosize[2]) {
case 1:
$tempimage = imagecreatefromgif($file);
$photoimage = imagecreatetruecolor($photosize[0], $photosize[1]);
imagecopy($photoimage, $tempimage, 0, 0, 0, 0, $photosize[0], $photosize[1]);
break;
case 2:
$photoimage = imagecreatefromjpeg($file);
break;
case 3:
$photoimage = imagecreatefrompng($file);
break;
}
if (empty($photoimage) or !$photoimage) {
return false;
}
// No image
$ps_x = $photosize[0];
$ps_y = $photosize[1];
$ws_x = $watersize[0];
$ws_y = $watersize[1];
$src_x = 0;
$src_y = 0;
if ($ws_x > $ps_x) {
$src_x = ($ws_x - $ps_x) / 2;
$ws_x = $ps_x;
}
if ($ws_y > $ps_y) {
$src_y = ($ws_y - $ps_y) / 2;
$ws_y = $ps_y;
}
$loy = substr($waterpos, 0, 3);
switch ($loy) {
case 'top':
$dest_y = 0;
break;
case 'cen':
$dest_y = ($ps_y - $ws_y) / 2;
break;
case 'bot':
$dest_y = $ps_y - $ws_y;
break;
default:
$dest_y = 0;
// should never get here
}
$lox = substr($waterpos, 3);
switch ($lox) {
case 'lft':
$dest_x = 0;
break;
//.........这里部分代码省略.........
开发者ID:billadams,项目名称:forever-frame,代码行数:101,代码来源:wppa-watermark.php
示例13: wppa_get_picture_html
function wppa_get_picture_html($args)
{
// Init
$defaults = array('id' => '0', 'type' => '', 'class' => '');
$args = wp_parse_args($args, $defaults);
$id = strval(intval($args['id']));
$type = $args['type'];
$class = $args['class'];
// Check existance of required args
foreach (array('id', 'type') as $item) {
if (!$args[$item]) {
wppa_dbg_msg('Missing ' . $item . ' in call to wppa_get_picture_html()', 'red', 'force');
return false;
}
}
// Check validity of args
if (!wppa_photo_exists($id)) {
wppa_dbg_msg('Photo ' . $id . ' does not exist in call to wppa_get_picture_html(). Type = ' . $type, 'red', 'force');
return false;
}
$types = array('sphoto', 'mphoto', 'xphoto', 'cover', 'thumb', 'ttthumb', 'comthumb', 'fthumb', 'twthumb', 'ltthumb', 'albthumb');
if (!in_array($type, $types)) {
wppa_dbg_msg('Unimplemented type ' . $type . ' in call to wppa_get_picture_html()', 'red', 'force');
return false;
}
// Get other data
$link = wppa_get_imglnk_a($type, $id);
$isthumb = strpos($type, 'thumb') !== false;
$file = wppa_fix_poster_ext($isthumb ? wppa_get_thumb_path($id) : wppa_get_photo_path($id), $id);
$href = wppa_fix_poster_ext($isthumb ? wppa_get_thumb_url($id) : wppa_get_photo_url($id), $id);
$autocol = wppa('auto_colwidth') || wppa('fullsize') > 0 && wppa('fullsize') <= 1.0;
$title = $link ? esc_attr($link['title']) : esc_attr(stripslashes(wppa_get_photo_name($id)));
$alt = wppa_get_imgalt($id);
// Find image style
switch ($type) {
case 'sphoto':
$style = 'width:100%;margin:0;';
if (!wppa_in_widget()) {
switch (wppa_opt('fullimage_border_width')) {
case '':
$style .= 'padding:0;' . 'border:none;';
break;
case '0':
$style .= 'padding:0;' . 'border:1px solid ' . wppa_opt('bcolor_fullimg') . ';' . 'box-sizing:border-box;';
break;
default:
$style .= 'padding:' . (wppa_opt('fullimage_border_width') - '1') . 'px;' . 'border:1px solid ' . wppa_opt('bcolor_fullimg') . ';' . 'box-sizing:border-box;' . 'background-color:' . wppa_opt('bgcolor_fullimg') . ';';
// If we do round corners...
if (wppa_opt('bradius') > '0') {
// then also here
$style .= 'border-radius:' . wppa_opt('fullimage_border_width') . 'px;';
}
}
}
break;
case 'mphoto':
case 'xphoto':
$style = 'width:100%;margin:0;padding:0;border:none;';
break;
default:
wppa_dbg_msg('Style for type ' . $type . ' is not implemented yet in wppa_get_picture_html()', 'red', 'force');
return false;
}
if ($link['is_lightbox']) {
$style .= 'cursor:url( ' . wppa_get_imgdir() . wppa_opt('magnifier') . ' ),pointer;';
$title = wppa_zoom_in($id);
}
// Create the html
$result = '';
// The link
if ($link) {
// Link is lightbox
if ($link['is_lightbox']) {
$lbtitle = wppa_get_lbtitle($type, $id);
$videobody = esc_attr(wppa_get_video_body($id));
$audiobody = esc_attr(wppa_get_audio_body($id));
$videox = wppa_get_videox($id);
$videoy = wppa_get_videoy($id);
$result .= '<a' . ' href="' . $link['url'] . '"' . ($lbtitle ? ' ' . wppa('lbtitle') . '="' . $lbtitle . '"' : '') . ($videobody ? ' data-videohtml="' . $videobody . '"' : '') . ($audiobody ? ' data-audiohtml="' . $audiobody . '"' : '') . ($videox ? ' data-videonatwidth="' . $videox . '"' : '') . ($videoy ? ' data-videonatheight="' . $videoy . '"' : '') . ' ' . wppa('rel') . '="' . wppa_opt('lightbox_name') . '"' . ($link['target'] ? ' target="' . $link['target'] . '"' : '') . ' class="thumb-img"' . ' id="a-' . $id . '-' . wppa('mocc') . '"' . ' data-alt="' . esc_attr(wppa_get_imgalt($id, true)) . '"' . ' >';
} else {
$result .= '<a' . (wppa_is_mobile() ? ' ontouchstart="wppaStartTime();" ontouchend="wppaTapLink(\'' . $id . '\',\'' . $link['url'] . '\');" ' : ' onclick="_bumpClickCount( \'' . $id . '\' );window.open(\'' . $link['url'] . '\', \'' . $link['target'] . '\' )"') . ' title="' . $link['title'] . '"' . ' class="thumb-img"' . ' id="a-' . $id . '-' . wppa('mocc') . '"' . ' >';
}
}
// The image
// Video?
if (wppa_is_video($id)) {
$result .= wppa_get_video_html(array('id' => $id, 'controls' => !$link, 'style' => $style, 'class' => $class));
} else {
$result .= '<img' . ' id="ph-' . $id . '-' . wppa('mocc') . '"' . ' src="' . $href . '"' . ' ' . wppa_get_imgalt($id) . ($class ? ' class="' . $class . '" ' : '') . ($title ? ' title="' . $title . '" ' : '') . ' style="' . $style . '"' . ' />';
}
// Close the link
if ($link) {
$result .= '</a>';
}
// Add audio? sphoto
if (wppa_has_audio($id)) {
$result .= '<div style="position:relative;z-index:11;" >';
// Find style for audio controls
switch ($type) {
case 'sphoto':
//.........这里部分代码省略.........
开发者ID:uwmadisoncals,项目名称:Cluster-Plugins,代码行数:101,代码来源:wppa-picture.php
示例14: wppa_album_photos
//.........这里部分代码省略.........
<td>
<?php
_e('Height:', 'wp-photo-album-plus');
?>
</td>
<td>
<input style="width:50px;margin:0 4px;" onkeyup="wppaAjaxUpdatePhoto( <?php
echo $photo['id'];
?>
, 'videoy', this ); " onchange="wppaAjaxUpdatePhoto( <?php
echo $photo['id'];
?>
, 'videoy', this ); " value="<?php
echo $photo['videoy'];
?>
" /><?php
echo sprintf(__('pix, (0=default:%s)', 'wp-photo-album-plus'), wppa_opt('video_height'));
?>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<th>
<label><?php
_e('Formats:', 'wp-photo-album-plus');
?>
</th>
<td>
<table class="wppa-subtable" >
<?php
foreach ($is_video as $fmt) {
echo '<tr>' . '<td>' . $fmt . '</td>' . '<td>' . __('Filesize:', 'wp-photo-album-plus') . '</td>' . '<td>' . wppa_get_filesize(str_replace('xxx', $fmt, wppa_get_photo_path($photo['id']))) . '</td>' . '</tr>';
}
?>
</table>
</td>
</tr>
<?php
}
?>
<!-- Audio -->
<?php
if ($has_audio) {
?>
<tr>
<th>
<label><?php
_e('Formats:', 'wp-photo-album-plus');
?>
</th>
<td>
<table class="wppa-subtable" >
<?php
foreach ($has_audio as $fmt) {
echo '<tr>' . '<td>' . $fmt . '</td>' . '<td>' . __('Filesize:', 'wp-photo-album-plus') . '</td>' . '<td>' . wppa_get_filesize(str_replace('xxx', $fmt, wppa_get_photo_path($photo['id']))) . '</td>' . '</tr>';
}
?>
</table>
</td>
</tr>
<?php
}
?>
开发者ID:msayagh,项目名称:Quercus-source-code-Maven,代码行数:67,代码来源:wppa-photo-admin-autosave.php
示例15: wppa_create_stereo_image
function wppa_create_stereo_image($id, $type, $glass)
{
static $f299;
static $f587;
static $f114;
// Init
if ($glass == 'rc') {
$glass = 'redcyan';
}
if (!is_array($f299)) {
$i = 0;
while ($i < 256) {
$f299[$i] = floor(0.299 * $i + 0.5);
$f587[$i] = floor(0.587 * $i + 0.5);
$f114[$i] = floor(0.114 * $i + 0.5);
$i++;
}
}
// Feature enabled?
if (!wppa_switch('enable_stereo')) {
return;
}
// Init.
$is_stereo = wppa_is_stereo($id);
if (!$is_stereo) {
return;
}
$stereodir = WPPA_UPLOAD_PATH . '/stereo';
if (!is_dir($stereodir)) {
wppa_mkdir($stereodir);
}
$fromfile = wppa_get_photo_path($id);
$tofile = wppa_get_stereo_path($id, $type, $glass);
$sizes = getimagesize($fromfile);
$width = $sizes['0'] / 2;
$height = $sizes['1'];
$fromimage = wppa_imagecreatefromjpeg($fromfile);
$toimage = imagecreatetruecolor($width, $height);
if ($is_stereo == 1) {
$offset1 = 0;
$offset2 = $width;
} else {
$offset1 = $width;
$offset2 = 0;
}
// Do the dirty work
switch ($type) {
case 'color':
for ($y = 0; $y < $height; $y++) {
for ($x = 0; $x < $width; $x++) {
$rgb1 = imagecolorat($fromimage, $x + $offset1, $y);
$r1 = $rgb1 >> 16 & 0xff;
$g1 = $rgb1 >> 8 & 0xff;
$b1 = $rgb1 & 0xff;
$rgb2 = imagecolorat($fromimage, $x + $offset2, $y);
$r2 = $rgb2 >> 16 & 0xff;
$g2 = $rgb2 >> 8 & 0xff;
$b2 = $rgb2 & 0xff;
// Red - Cyan glass
if ($glass == 'redcyan') {
$newpix = $r2 << 16 | $g1 << 8 | $b1;
} else {
$newpix = $r1 << 16 | $g2 << 8 | $b1;
}
imagesetpixel($toimage, $x, $y, $newpix);
}
}
imagejpeg($toimage, $tofile, wppa_opt('jpeg_quality'));
break;
case 'gray':
for ($y = 0; $y < $height; $y++) {
for ($x = 0; $x < $width; $x++) {
$rgb1 = imagecolorat($fromimage, $x + $offset1, $y);
$r1 = $rgb1 >> 16 & 0xff;
$g1 = $rgb1 >> 8 & 0xff;
$b1 = $rgb1 & 0xff;
$rgb2 = imagecolorat($fromimage, $x + $offset2, $y);
$r2 = $rgb2 >> 16 & 0xff;
$g2 = $rgb2 >> 8 & 0xff;
$b2 = $rgb2 & 0xff;
// Red - Cyan glass
if ($glass == 'redcyan') {
$r = $f299[$r2] + $f587[$g2] + $f114[$b2];
$g = $f299[$r1] + $f587[$g1] + $f114[$b1];
$b = $f299[$r1] + $f587[$g1] + $f114[$b1];
$newpix = $r << 16 | $g << 8 | $b;
} else {
$r = $f299[$r1] + $f587[$g1] + $f114[$b1];
$g = $f299[$r2] + $f587[$g2] + $f114[$b2];
$b = $f299[$r1] + $f587[$g1] + $f114[$b1];
$newpix = $r << 16 | $g << 8 | $b;
}
imagesetpixel($toimage, $x, $y, $newpix);
}
}
imagejpeg($toimage, $tofile, wppa_opt('jpeg_quality'));
break;
case 'true':
for ($y = 0; $y < $height; $y++) {
for ($x = 0; $x < $width; $x++) {
//.........这里部分代码省略.........
开发者ID:uwmadisoncals,项目名称:Cluster-Plugins,代码行数:101,代码来源:wppa-stereo.php
示例16: wppa_get_thumbphotoxy
function wppa_get_thumbphotoxy($id, $key, $force = false)
{
$result = wppa_get_photo_item($id, $key);
if ($result && !$force) {
return $result;
// Value found
}
if ($key == 'thumbx' || $key == 'thumby') {
$file = wppa_get_thumb_path($id);
} else {
$file = wppa_get_photo_path($id);
}
if (wppa_get_ext($file) == 'xxx') {
// if ( $key == 'photox' || $key == 'photoy' ) {
$file = wppa_fix_poster_ext($file, $id);
// }
}
if (!is_file($file) && !$force) {
return '0';
// File not found
}
if (is_file($file)) {
$size = getimagesize($file);
} else {
$size = array('0', '0');
}
if (is_array($size)) {
if ($key == 'thumbx' || $key == 'thumby') {
wppa_update_photo(array('id' => $id, 'thumbx' => $size[0], 'thumby' => $size[1]));
} else {
wppa_update_photo(array('id' => $id, 'photox' => $size[0], 'photoy' => $size[1]));
}
wppa_cache_photo('invalidate', $id);
}
if ($key == 'thumbx' || $key == 'photox') {
return $size[0];
} else {
return $size[1];
}
}
开发者ID:billadams,项目名称:forever-frame,代码行数:40,代码来源:wppa-items.php
示例17: _wppa_page_options
//.........这里部分代码省略.........
default:
wppa_error_message('Unimplemnted action key: ' . $key);
}
// Make sure we are uptodate
wppa_initialize_runtime(true);
}
// wppa-settings-submit
// See if a cloudinary upload is pending
$need_cloud = wppa_switch('wppa_cdn_service_update');
global $blog_id;
if ($need_cloud) {
switch (wppa_cdn()) {
case 'cloudinary':
if (!function_exists('wppa_upload_to_cloudinary')) {
wppa_error_message('Trying to upload to Cloudinary, but it is not configured');
exit;
}
$j = '0';
$last = get_option('wppa_last_cloud_upload', '0');
$photos = $wpdb->get_results("SELECT * FROM `" . WPPA_PHOTOS . "` WHERE `id` > " . $last . " ORDER BY `id` LIMIT 1000", ARRAY_A);
if (empty($photos)) {
wppa_ok_message(__('Ready uploading to Cloudinary', 'wppa'));
update_option('wppa_cdn_service_update', 'no');
update_option('wppa_last_cloud_upload', '0');
wppa_ready_on_cloudinary();
} else {
$count = $wpdb->get_var($wpdb->prepare("SELECT COUNT(*) FROM `" . WPPA_PHOTOS . "` WHERE `id` > %s", $last));
wppa_update_message('Uploading to Cloudinary cloud name: ' . wppa_opt('wppa_cdn_cloud_name') . '. ' . $count . ' images to go.');
$present_at_cloudinary = wppa_get_present_at_cloudinary_a();
if ($photos) {
foreach ($photos as $photo) {
if (!isset($present_at_cloudinary[$photo['id']])) {
echo '[' . $photo['id'] . ']';
$path = wppa_get_photo_path($photo['id']);
if (file_exists($path)) {
wppa_upload_to_cloudinary($photo
|
请发表评论