本文整理汇总了PHP中wppa_fix_poster_ext函数的典型用法代码示例。如果您正苦于以下问题:PHP wppa_fix_poster_ext函数的具体用法?PHP wppa_fix_poster_ext怎么用?PHP wppa_fix_poster_ext使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wppa_fix_poster_ext函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: wppa_get_video_html
function wppa_get_video_html($args)
{
global $wppa;
extract(wp_parse_args((array) $args, array('id' => '0', 'width' => '0', 'height' => '0', 'controls' => true, 'margin_top' => '0', 'margin_bottom' => '0', 'tagid' => 'video-' . $wppa['mocc'], 'cursor' => '', 'events' => '', 'title' => '', 'preload' => 'metadata', 'onclick' => '', 'lb' => false, 'class' => '', 'style' => '', 'use_thumb' => false, 'autoplay' => false)));
// No id? no go
if (!$id) {
return '';
}
// Not a video? no go
if (!wppa_is_video($id)) {
return '';
}
extract(wp_parse_args((array) wppa_is_video($id), array('mp4' => false, 'ogv' => false, 'webm' => false)));
// Prepare attributes
$w = $width ? ' width:' . $width . 'px;' : '';
$h = $height ? ' height:' . $height . 'px;' : '';
$t = $margin_top ? ' margin-top:' . $margin_top . 'px;' : '';
$b = $margin_bottom ? ' margin-bottom:' . $margin_bottom . 'px;' : '';
$ctrl = $controls ? ' controls' : '';
$tit = $title ? ' title="' . $title . '"' : '';
$onc = $onclick ? ' onclick="' . $onclick . '"' : '';
$cls = $class ? ' class="' . $class . '"' : '';
$style = $style ? rtrim(trim($style), ';') . ';' : '';
$play = $autoplay ? ' autoplay' : '';
// See if there is a poster image
$poster_photo_path = wppa_fix_poster_ext(wppa_get_photo_path($id), $id);
$poster_thumb_path = wppa_fix_poster_ext(wppa_get_thumb_path($id), $id);
$poster_photo = is_file($poster_photo_path) ? ' poster="' . wppa_fix_poster_ext(wppa_get_photo_url($id), $id) . '"' : '';
$poster_thumb = is_file($poster_thumb_path) ? ' poster="' . wppa_fix_poster_ext(wppa_get_thumb_url($id), $id) . '"' : '';
$poster = '';
// Init to none
// Thumbnail?
if ($use_thumb) {
$poster = $poster_thumb;
} else {
$poster = $poster_photo;
}
// If the poster exists and no controls, we need no preload at all.
if ($poster && !$controls) {
$preload = 'none';
}
// Do we have html5 video tag supported filetypes on board?
if ($mp4 || $ogv || $webm) {
// Assume the browser supports html5
$result = '<video id="' . $tagid . '" ' . $ctrl . $play . ' style="' . $style . $w . $h . $t . $b . $cursor . '" ' . $events . ' ' . $tit . $onc . $poster . ' preload="' . $preload . '"' . $cls . ' >';
$result .= wppa_get_video_body($id, false, $width, $height);
// Close the video tag
$result .= '</video>';
}
// Done
return $result;
}
开发者ID:billadams,项目名称:forever-frame,代码行数:52,代码来源:wppa-video.php
示例2: wppa_album_sequence
//.........这里部分代码省略.........
xmlhttp.onreadystatechange = function() {
if ( xmlhttp.readyState == 4 && xmlhttp.status != 404 ) {
var ArrValues = xmlhttp.responseText.split( "||" );
if ( ArrValues[0] != '' ) {
alert( 'The server returned unexpected output:\n' + ArrValues[0] );
}
switch ( ArrValues[1] ) {
case '0': // No error
var i = seqno - 1;
var descend = <?php
if ($is_descending) {
echo 'true';
} else {
echo 'false';
}
?>
;
if ( descend ) {
i = <?php
echo count($albums);
?>
- seqno;
}
jQuery( '#wppa-album-seqno-' + album ).html( seqno );
if ( wppaRenumberPending ) {
jQuery( '#wppa-pb-'+i ).css({backgroundColor:'orange'});
}
else {
jQuery( '#wppa-pb-'+i ).css({backgroundColor:'green'});
}
if ( wppaLastAlbum = album ) {
wppaRenumberBusy = false;
}
break;
default: // Any error
jQuery( '#wppa-album-seqno-' + album ).html( '<span style="color"red" >Err:' + ArrValues[1] + '</span>' );
break;
}
wppaAjaxInProgress--;
// No longer busy?
if ( wppaAjaxInProgress == 0 ) {
if ( wppaRenumberPending ) {
// Redo
wppaRenumberPending = false;
wppaDoRenumber();
}
}
}
}
xmlhttp.open( 'POST',wppaAjaxUrl,true );
xmlhttp.setRequestHeader( "Content-type","application/x-www-form-urlencoded" );
xmlhttp.send( data );
wppaAjaxInProgress++;
jQuery( "#wppa-sort-seqn-albums-" + album ).attr( 'value', seqno ); // set hidden value to new value to prevent duplicate action
var spinnerhtml = '<img src="' + wppaImageDirectory + 'spinner.gif' + '" />';
jQuery( '#wppa-album-seqno-' + album ).html( spinnerhtml );
}
</script>
<br />
<div id="wppa-progbar" style="width:100%;height:12px;" >
<?php
$c = count($albums);
$l = 100 / $c;
$i = 0;
while ($i < $c) {
echo '<div' . ' id="wppa-pb-' . $i . '"' . ' style="display:inline;float:left;background-color:green;height:12px;width:' . $l . '%;"' . ' >' . '</div>';
$i++;
}
?>
</div>
<br />
<div class="widefat" style="max-width:600px;" >
<div id="sortable-albums">
<?php
foreach ($albums as $album) {
$cover_photo_id = wppa_get_coverphoto_id($album['id']);
echo '
<div' . ' id="albumitem-' . $album['id'] . '"' . ' class="ui-state-default-albums"' . ' style="background-color:#eeeeee;cursor:move;"' . ' >' . '<div' . ' style="height:100%;width:25%;float:left;text-align:center;overflow:hidden;" >';
if (wppa_is_video($cover_photo_id)) {
echo wppa_get_video_html(array('id' => $cover_photo_id, 'height' => '50', 'margin_top' => '5', 'margin_bottom' => '5', 'controls' => false));
} else {
echo '<img' . ' class="wppa-cover-image"' . ' src="' . wppa_fix_poster_ext(wppa_get_thumb_url(wppa_get_coverphoto_id($album['id'])), $cover_photo_id) . '"' . ' style="max-height:50px; margin: 5px;"' . ' />';
}
echo '</div>' . '<div style="height:100%;width:40%;float:left;font-size:12px;overflow:hidden;" >' . '<b>' . wppa_get_album_name($album['id']) . '</b>' . '<br />' . wppa_get_album_desc($album['id']) . '</div>' . '<div style="float:right;width:10%;" >' . '<table>' . '<tr><td>' . '<img' . ' src="' . wppa_get_imgdir('up.png') . '"' . ' title="' . esc_attr(__('To top', 'wp-photo-album-plus')) . '"' . ' style="cursor:pointer;"' . ' onclick="' . 'jQuery( \'#albumitem-' . $album['id'] . '\' ).parent().prepend(jQuery( \'#albumitem-' . $album['id'] . '\' ));' . 'wppaDoRenumber();' . '"' . ' />' . '</td></tr>' . '<tr><td>' . '<img' . ' src="' . wppa_get_imgdir('up.png') . '"' . ' title="' . esc_attr(__('One up', 'wp-photo-album-plus')) . '"' . ' style="cursor:pointer;width:24px;"' . ' onclick="' . 'jQuery( \'#albumitem-' . $album['id'] . '\' ).prev().before(jQuery( \'#albumitem-' . $album['id'] . '\' ));' . 'wppaDoRenumber();' . '"' . ' />' . '</td></tr>' . '<tr><td>' . '<img' . ' src="' . wppa_get_imgdir('down.png') . '"' . ' title="' . esc_attr(__('One down', 'wp-photo-album-plus')) . '"' . ' style="cursor:pointer;width:24px;"' . ' onclick="' . 'jQuery( \'#albumitem-' . $album['id'] . '\' ).next().after(jQuery( \'#albumitem-' . $album['id'] . '\' ));' . 'wppaDoRenumber();' . '"' . ' />' . '</td></tr>' . '<tr><td>' . '<img' . ' src="' . wppa_get_imgdir('down.png') . '"' . ' title="' . esc_attr(__('To bottom', 'wp-photo-album-plus')) . '"' . ' style="cursor:pointer;"' . ' onclick="' . 'jQuery( \'#albumitem-' . $album['id'] . '\' ).parent().append(jQuery( \'#albumitem-' . $album['id'] . '\' ));' . 'wppaDoRenumber();' . '"' . ' />' . '</td></tr>' . '</table>' . '</div>' . '<div style="float:right; width:25%;" >' . '<span style=""> ' . __('Id:', 'wp-photo-album-plus') . ' ' . $album['id'] . '</span>' . '<span style=""> - ' . __('Ord:', 'wp-photo-album-plus') . '</span>' . '<span id="wppa-album-seqno-' . $album['id'] . '" > ' . $album['a_order'] . '</span>' . '<br />' . '<a href="' . wppa_ea_url($album['id']) . '" style="position:absolute;bottom:0;" >' . __('Edit', 'wp-photo-album-plus') . '</a>' . '</div>' . '<input type="hidden" id="album-nonce-' . $album['id'] . '" value="' . wp_create_nonce('wppa_nonce_' . $album['id']) . '" />' . '<input type="hidden" class="wppa-sort-item-albums" value="' . $album['id'] . '" />' . '<input type="hidden" class="wppa-sort-seqn-albums" id="wppa-sort-seqn-albums-' . $album['id'] . '" value="' . $album['a_order'] . '" />' . '</div>';
}
?>
</div>
<div style="clear:both;"></div>
</div>
<?php
}
开发者ID:uwmadisoncals,项目名称:Cluster-Plugins,代码行数:101,代码来源:wppa-album-admin-autosave.php
示例3: wppa_get_imgstyle_a
function wppa_get_imgstyle_a($id, $file, $xmax_size, $xvalign = '', $type = '')
{
global $wppa;
$result = array('style' => '', 'width' => '', 'height' => '', 'cursor' => '', 'margin-top' => '', 'margin-bottom' => '');
// Init
wppa_cache_thumb($id);
if (!$id) {
return $result;
}
// no image: no dimensions
if ($file == '') {
return $result;
}
// no image: no dimensions
if (wppa_has_audio($id)) {
$file = wppa_fix_poster_ext($file, $id);
}
if (!wppa_is_video($id) && !is_file($file)) {
wppa_dbg_msg('Please check file ' . $file . ' it is missing while expected. Id=' . $id, 'red');
return $result;
// no file: no dimensions ( 2.3.0 )
}
if (strpos($file, '/wppa/thumbs/')) {
$image_attr = wppa_get_imagexy($id, 'thumb');
} else {
$image_attr = wppa_get_imagexy($id, 'photo');
}
// if ( wppa_is_video( $id ) ) {
// $image_attr = array( '0' => wppa_get_videox( $id ), '1' => wppa_get_videoy( $id ) );
// }
// else {
// $image_attr = array( '0' => wppa_get_photox( $id ), '1' => wppa_get_photoy( $id ) );
// }
if (!$image_attr || !isset($image_attr['0']) || !$image_attr['0'] || !isset($image_attr['1']) || !$image_attr['1']) {
// File is corrupt
wppa_dbg_msg('Please check file ' . $file . ' it is corrupted. If it is a thumbnail image,' . ' regenerate them using Table VIII-A4 of the Photo Albums -> Settings admin page.', 'red');
return $result;
}
// Adjust for 'border'
if ($type == 'fullsize' && !$wppa['in_widget']) {
switch (wppa_opt('wppa_fullimage_border_width')) {
case '':
$max_size = $xmax_size;
break;
case '0':
$max_size = $xmax_size - '2';
break;
default:
$max_size = $xmax_size - '2' - 2 * wppa_opt('wppa_fullimage_border_width');
}
} else {
$max_size = $xmax_size;
}
$ratioref = wppa_opt('wppa_maxheight') / wppa_opt('wppa_fullsize');
$max_height = round($max_size * $ratioref);
if ($type == 'fullsize') {
if ($wppa['portrait_only']) {
$width = $max_size;
$height = round($width * $image_attr[1] / $image_attr[0]);
} else {
if (wppa_is_wider($image_attr[0], $image_attr[1])) {
$width = $max_size;
$height = round($width * $image_attr[1] / $image_attr[0]);
} else {
$height = round($ratioref * $max_size);
$width = round($height * $image_attr[0] / $image_attr[1]);
}
if ($image_attr[0] < $width && $image_attr[1] < $height) {
if (!$wppa['enlarge']) {
$width = $image_attr[0];
$height = $image_attr[1];
}
}
}
} else {
if ($type == 'cover' && wppa_switch('wppa_coversize_is_height') && (wppa_opt('wppa_coverphoto_pos') == 'top' || wppa_opt('wppa_coverphoto_pos') == 'bottom')) {
$height = $max_size;
$width = round($max_size * $image_attr[0] / $image_attr[1]);
} else {
if (wppa_is_landscape($image_attr)) {
$width = $max_size;
$height = round($max_size * $image_attr[1] / $image_attr[0]);
} else {
$height = $max_size;
$width = round($max_size * $image_attr[0] / $image_attr[1]);
}
}
}
switch ($type) {
case 'cover':
if (wppa_opt('wppa_bcolor_img') != '') {
// There is a border color given
$result['style'] .= ' border: 1px solid ' . wppa_opt('wppa_bcolor_img') . ';';
} else {
// No border color: no border
$result['style'] .= ' border-width: 0px;';
}
$result['style'] .= ' width:' . $width . 'px; height:' . $height . 'px;';
if (wppa_switch('wppa_use_cover_opacity') && !is_feed()) {
$opac = wppa_opt('wppa_cover_opacity');
//.........这里部分代码省略.........
开发者ID:billadams,项目名称:forever-frame,代码行数:101,代码来源:wppa-styles.php
示例4: 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
示例5: _wppa_comment_admin
function _wppa_comment_admin()
{
global $wpdb;
$continue = true;
// Check input
wppa_vfy_arg('tab', true);
wppa_vfy_arg('edit_id');
wppa_vfy_arg('wppa-page');
wppa_vfy_arg('commentid');
wppa_vfy_arg('delete_id');
if (isset($_GET['tab'])) {
if ($_GET['tab'] == 'edit') {
$id = $_GET['edit_id'];
$comment = $wpdb->get_row($wpdb->prepare("SELECT * FROM " . WPPA_COMMENTS . " WHERE id = %s LIMIT 1", $id), ARRAY_A);
if ($comment) {
?>
<div class="wrap">
<?php
$iconurl = WPPA_URL . '/img/comment.png';
?>
<div id="icon-album" class="icon32" style="background: transparent url(<?php
echo $iconurl;
?>
) no-repeat">
<br />
</div>
<h2><?php
_e('Photo Albums -> Edit Comment', 'wp-photo-album-plus');
?>
</h2>
<?php
$action = wppa_dbg_url(get_admin_url() . 'admin.php?page=wppa_manage_comments');
if (isset($_GET['wppa-page'])) {
$action .= '&compage=' . strval(intval($_GET['wppa-page']));
}
if (isset($_GET['commentid'])) {
$action .= '&commentid=' . strval(intval($_GET['commentid']));
}
?>
<form action="<?php
echo $action;
?>
" method="post">
<?php
wp_nonce_field('$wppa_nonce', WPPA_NONCE);
?>
<input type="hidden" name="edit_comment" value="<?php
echo $comment['id'];
?>
" />
<table class="form-table albumtable">
<tbody>
<tr style="vertical-align:top" >
<th>
<?php
$photo = $wpdb->get_row($wpdb->prepare("SELECT * FROM " . WPPA_PHOTOS . " WHERE id = %s", $comment['photo']), "ARRAY_A");
?>
<?php
$url = wppa_fix_poster_ext(wppa_get_thumb_url($comment['photo']), $comment['photo']);
?>
<img src="<?php
echo $url;
?>
" />
</th>
<td>
<?php
echo __($photo['name']) . '<br/><br/>' . __(stripslashes($photo['description']));
?>
</td>
</tr>
<tr>
<th scope="row"><label ><?php
_e('Photo:', 'wp-photo-album-plus');
?>
</label></th>
<td><?php
echo $comment['photo'];
?>
</td>
</tr>
<tr>
<th scope="row"><label ><?php
_e('Album:', 'wp-photo-album-plus');
?>
</label></th>
<td><?php
echo wppa_get_album_name($photo['album']);
?>
</td>
</tr>
<tr>
<th scope="row"><label ><?php
_e('User:', 'wp-photo-album-plus');
?>
</label></th>
<td><input style="width:300px;" type="text" name="user" value="<?php
echo $comment['user'];
?>
//.........这里部分代码省略.........
开发者ID:uwmadisoncals,项目名称:Cluster-Plugins,代码行数:101,代码来源:wppa-comment-admin.php
示例6: wppa_add_metatags
function wppa_add_metatags()
{
global $wpdb;
// Share info for sm that uses og
$id = wppa_get_get('photo');
if (!wppa_photo_exists($id)) {
$id = false;
}
if ($id) {
// SM may not accept images from the cloud.
wppa('for_sm', true);
$imgurl = wppa_get_photo_url($id);
wppa('for_sm', false);
if (wppa_is_video($id)) {
$imgurl = wppa_fix_poster_ext($imgurl, $id);
}
} else {
$imgurl = '';
}
if ($id) {
if (wppa_switch('og_tags_on')) {
$thumb = wppa_cache_thumb($id);
if ($thumb) {
$title = wppa_get_photo_name($id);
$desc = wppa_get_og_desc($id);
$url = (is_ssl() ? 'https://' : 'http://') . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
$site = get_bloginfo('name');
$mime = wppa_get_mime_type($id);
echo '
<!-- WPPA+ Og Share data -->
<meta property="og:site_name" content="' . esc_attr(sanitize_text_field($site)) . '" />
<meta property="og:type" content="article" />
<meta property="og:url" content="' . $url . '" />
<meta property="og:title" content="' . esc_attr(sanitize_text_field($title)) . '" />';
if ($mime) {
echo '
<meta property="og:image" content="' . esc_url(sanitize_text_field($imgurl)) . '" />
<meta property="og:image:type" content="' . $mime . '" />
<meta property="og:image:width" content="' . wppa_get_photox($id) . '" />
<meta property="og:image:height" content="' . wppa_get_photoy($id) . '" />';
}
if ($desc) {
echo '
<meta property="og:description" content="' . esc_attr(sanitize_text_field($desc)) . '" />';
}
echo '
<!-- WPPA+ End Og Share data -->
';
}
}
if (wppa_switch('share_twitter') && wppa_opt('twitter_account')) {
$thumb = wppa_cache_thumb($id);
// Twitter wants at least 280px in width, and at least 150px in height
if ($thumb) {
$x = wppa_get_photo_item($id, 'photox');
$y = wppa_get_photo_item($id, 'photoy');
}
if ($thumb && $x >= 280 && $y >= 150) {
$title = wppa_get_photo_name($id);
$desc = wppa_get_og_desc($id);
$url = (is_ssl() ? 'https://' : 'http://') . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
$site = get_bloginfo('name');
echo '
<!-- WPPA+ Twitter Share data -->
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:site" content="' . wppa_opt('twitter_account') . '">
<meta name="twitter:creator" content="' . wppa_opt('twitter_account') . '">
<meta name="twitter:title" content="' . esc_attr(sanitize_text_field($title)) . '">
<meta name="twitter:description" content="' . esc_attr(sanitize_text_field($desc)) . '">
<meta name="twitter:image" content="' . esc_url(sanitize_text_field($imgurl)) . '">
<!-- WPPA+ End Twitter Share data -->
';
} elseif ($thumb && $x >= 120 && $y >= 120) {
$title = wppa_get_photo_name($id);
$desc = wppa_get_og_desc($id);
$url = (is_ssl() ? 'https://' : 'http://') . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
$site = get_bloginfo('name');
echo '
<!-- WPPA+ Twitter Share data -->
<meta name="twitter:card" content="summary">
<meta name="twitter:site" content="' . wppa_opt('twitter_account') . '">
<meta name="twitter:title" content="' . esc_attr(sanitize_text_field($title)) . '">
<meta name="twitter:description" content="' . esc_attr(sanitize_text_field($desc)) . '">
<meta name="twitter:image" content="' . esc_url(sanitize_text_field($imgurl)) . '">
<!-- WPPA+ End Twitter Share data -->
';
}
}
}
// To make sure we are on a page that contains at least [wppa] we check for Get var 'wppa-album'.
// This also narrows the selection of featured photos to those that exist in the current album.
$done = array();
$album = '';
if (isset($_REQUEST['album'])) {
$album = $_REQUEST['album'];
} elseif (isset($_REQUEST['wppa-album'])) {
$album = $_REQUEST['wppa-album'];
}
$album = strip_tags($album);
if (strlen($album == 12)) {
//.........这里部分代码省略.........
开发者ID:uwmadisoncals,项目名称:Cluster-Plugins,代码行数:101,代码来源:wppa-non-admin.php
示例7: wppa_copy_photo
function wppa_copy_photo($photoid, $albumto)
{
global $wpdb;
$err = '1';
// Check args
if (!is_numeric($photoid) || !is_numeric($albumto)) {
return $err;
}
$err = '2';
// Find photo details
$photo = $wpdb->get_row($wpdb->prepare('SELECT * FROM ' . WPPA_PHOTOS . ' WHERE id = %s', $photoid), 'ARRAY_A');
if (!$photo) {
return $err;
}
$albumfrom = $photo['album'];
$album = $albumto;
$ext = $photo['ext'];
$name = $photo['name'];
$porder = '0';
$desc = $photo['description'];
$linkurl = $photo['linkurl'];
$linktitle = $photo['linktitle'];
$linktarget = $photo['linktarget'];
$status = $photo['status'];
$filename = $photo['filename'];
$location = $photo['location'];
$oldimage = wppa_fix_poster_ext(wppa_get_photo_path($photo['id']), $photo['id']);
$oldthumb = wppa_fix_poster_ext(wppa_get_thumb_path($photo['id']), $photo['id']);
$tags = $photo['tags'];
$exifdtm = $photo['exifdtm'];
$err = '3';
// Make new db table entry
$owner = wppa_switch('copy_owner') ? $photo['owner'] : wppa_get_user();
$time = wppa_switch('copy_timestamp') ? $photo['timestamp'] : time();
$id = wppa_create_photo_entry(array('album' => $album, 'ext' => $ext, 'name' => $name, 'p_order' => $porder, 'description' => $desc, 'linkurl' => $linkurl, 'linktitle' => $linktitle, 'linktarget' => $linktarget, 'timestamp' => $time, 'owner' => $owner, 'status' => $status, 'filename' => $filename, 'location' => $location, 'tags' => $tags, 'exifdtm' => $exifdtm, 'videox' => $photo['videox'], 'videoy' => $photo['videoy']));
if (!$id) {
return $err;
}
wppa_flush_treecounts($album);
wppa_index_add('photo', $id);
$err = '4';
// Find copied photo details
if (!$id) {
return $err;
}
$image_id = $id;
$newimage = wppa_strip_ext(wppa_get_photo_path($image_id)) . '.' . wppa_get_ext($oldimage);
$newthumb = wppa_strip_ext(wppa_get_thumb_path($image_id)) . '.' . wppa_get_ext($oldthumb);
$err = '5';
// Do the filesystem copy
if (wppa_is_video($photo['id'])) {
if (!wppa_copy_video_files($photo['id'], $image_id)) {
return $err;
}
} elseif (wppa_has_audio($photo['id'])) {
if (!wppa_copy_audio_files($photo['id'], $image_id)) {
return $err;
}
}
$err = '6';
// Copy photo or poster
if (!copy($oldimage, $newimage)) {
return $err;
}
$err = '7';
// Copy thumbnail
if (!copy($oldthumb, $newthumb)) {
return $err;
}
$err = '8';
// Copy source
wppa_copy_source($filename, $albumfrom, $albumto);
$err = '9';
// Copy Exif and iptc
wppa_copy_exif($photoid, $id);
wppa_copy_iptc($photoid, $id);
// Bubble album timestamp
if (!wppa_switch('copy_timestamp')) {
wppa_update_album(array('id' => $albumto, 'modified' => time()));
}
return false;
// No error
}
开发者ID:msayagh,项目名称:Quercus-source-code-Maven,代码行数:83,代码来源:wppa-admin-functions.php
示例8: wppa_sphoto
function wppa_sphoto()
{
$id = wppa('single_photo');
$width = wppa_get_container_width();
$height = floor($width / wppa_get_ratio($id));
$usethumb = wppa_use_thumb_file($id, $width, $height);
$src = $usethumb ? wppa_get_thumb_url($id, '', $width, $height) : wppa_get_photo_url($id, '', $width, $height);
if (wppa_has_audio($id)) {
$src = wppa_fix_poster_ext($src, $id);
}
if (!wppa_in_widget()) {
wppa_bump_viewcount('photo', $id);
}
$autocol = wppa('auto_colwidth') || $width > 0 && $width <= 1.0;
// The initial width is $width if not autocol, else it should default to initial column width when auto
// or initial column width * fraction
if ($autocol) {
if ($width == 'auto') {
$contwidth = wppa_opt('initial_colwidth');
} else {
$contwidth = wppa_opt('initial_colwidth') * $width;
}
} else {
$contwidth = $width;
}
// Open the pseudo container
wppa_out('<div' . ' id="wppa-container-' . wppa('mocc') . '"' . ' class="' . (wppa('align') ? 'align' . wppa('align') : '') . ' wppa-sphoto-' . wppa('mocc') . '"' . ' style="width:' . $contwidth . 'px;position:relative;"' . ' >');
// The script for responsive
wppa_add_js_page_data("\n" . '<script type="text/javascript">');
if ($autocol) {
wppa_add_js_page_data("\n" . 'wppaAutoColumnWidth[' . wppa('mocc') . '] = true;');
if ($width > 0 && $width <= 1.0) {
wppa_add_js_page_data("\n" . 'wppaAutoColumnFrac[' . wppa('mocc') . '] = ' . $width . ';');
} else {
wppa_add_js_page_data("\n" . 'wppaAutoColumnFrac[' . wppa('mocc') . '] = 1.0;');
}
wppa_add_js_page_data("\n" . 'wppaColWidth[' . wppa('mocc') . '] = 0;');
}
wppa_add_js_page_data("\n" . 'wppaTopMoc = ' . wppa('mocc') . ';');
wppa_add_js_page_data("\n" . '</script>');
wppa('portrait_only', true);
$fis = wppa_get_fullimgstyle_a($id);
$width = $fis['width'];
$height = $fis['height'];
$style = $fis['style'];
$style .= 'box-sizing:content-box;vertical-align:middle;';
// The link
$link = wppa_get_imglnk_a('sphoto', $id);
if ($link) {
if ($link['is_lightbox']) {
$lbtitle = wppa_get_lbtitle('sphoto', $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);
wppa_out('<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') . '"' . ' >');
} else {
wppa_out('<a' . ' href="' . $link['url'] . '"' . ' title="' . $link['title'] . '"' . ' target="' . $link['target'] . '"' . ' class="thumb-img"' . ' id="a-' . $id . '-' . wppa('mocc') . '"' . ' >');
}
}
// The image
$title = $link ? esc_attr($link['title']) : esc_attr(stripslashes(wppa_get_photo_name($id)));
if ($link['is_lightbox']) {
$style .= ' cursor:url( ' . wppa_get_imgdir() . wppa_opt('magnifier') . ' ),pointer;';
$title = wppa_zoom_in($id);
}
if (wppa_is_video($id)) {
if ($autocol) {
wppa_out(wppa_get_video_html(array('id' => $id, 'controls' => !$link['is_lightbox'], 'style' => $style, 'class' => 'size-medium wppa-sphoto wppa-simg-' . wppa('mocc'))));
} else {
wppa_out(wppa_get_video_html(array('id' => $id, 'width' => $width, 'height' => $height, 'controls' => !$link['is_lightbox'], 'style' => $style, 'class' => 'size-medium wppa-sphoto wppa-simg-' . wppa('mocc'))));
}
} else {
wppa_out('<img' . ' src="' . $src . '"' . ' ' . wppa_get_imgalt($id) . ' class="size-medium wppa-sphoto wppa-simg-' . wppa('mocc') . '"' . ' ' . wppa_get_imgalt($id) . ($title ? ' title="' . $title . '" ' : '') . ' style="' . $style . '"' . ($autocol ? '' : ' width="' . $width . '" height="' . $height . '" ') . '/ >');
}
// Close the link
if ($link) {
wppa_out('</a>');
}
// Add audio? sphoto
if (wppa_has_audio($id)) {
wppa_out('<div style="position:relative;z-index:11;" >');
$margl = wppa_opt('fullimage_border_width') === '' ? 0 : wppa_opt('fullimage_border_width') + 1;
$margb = $margl;
wppa_out(wppa_get_audio_html(array('id' => $id, 'cursor' => 'cursor:pointer;', 'style' => $style . 'position:absolute;' . 'left:' . $margl . 'px;' . 'bottom:' . $margb . 'px;' . 'padding:0;' . 'margin:0;' . 'border:none;' . 'height:' . wppa_get_audio_control_height() . 'px;' . 'border-radius:0;', 'class' => 'size-medium wppa-sphoto wppa-simg-' . wppa('mocc'))));
wppa_out('</div>');
}
// The pseudo container
wppa_out('</div>');
}
开发者ID:msayagh,项目名称:Quercus-source-code-Maven,代码行数:90,代码来源:wppa-functions.php
示例9: wppa_get_source_pl
function wppa_get_source_pl($id)
{
$result = '';
$source_path = wppa_fix_poster_ext(wppa_get_source_path($id), $id);
if (is_file($source_path)) {
$result = content_url() . '/' . wppa_opt('wppa_pl_dirname') . '/' . wppa_sanitize_file_name(wppa_get_album_item(wppa_get_photo_item($id, 'album'), 'name'), false) . '/' . basename($source_path);
// My-Photo.jpg
}
return $result;
}
开发者ID:billadams,项目名称:forever-frame,代码行数:10,代码来源:wppa-utils.php
示例10: 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_fix_poster_ext(wppa_get_photo_path($id), $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 = wppa_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';
if ($ang == '360') {
if (!imageflip($source, IMG_FLIP_HORIZONTAL)) {
return $err;
}
$rotate = $source;
} else {
$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);
// accessable
wppa_chmod($file);
// Optimized
wppa_optimize_image_file($file);
// 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;
//.........这里部分代码省略.........
开发者ID:uwmadisoncals,项目名称:Cluster-Plugins,代码行数:101,代码来源:wppa-admin-functions.php
示例11: wppa_subalbumlinks_html
function wppa_subalbumlinks_html($id, $top = true)
{
global $wpdb;
// Do they need us? Anything to display?
if (wppa_opt('cover_sublinks_display') == 'none') {
return;
}
// Display type
$display_type = wppa_opt('cover_sublinks_display');
// Link type
$link_type = wppa_opt('cover_sublinks');
// Init
$is_list = $display_type == 'list' || $display_type == 'recursivelist';
$is_recursive = $display_type == 'recursivelist';
$first = true;
// Get the children
$subs = $wpdb->get_results("SELECT * FROM `" . WPPA_ALBUMS . "` WHERE `a_parent` = " . $id . " " . wppa_get_album_order($id), ARRAY_A);
// Only if there are sub-albums
if (!empty($subs)) {
wppa_out('<div>');
// Local css
if ($top) {
if ($is_list) {
wppa_out('<style scoped="scoped" >' . 'ul, li { margin:0; }' . 'ul {' . 'list-style-type:disc;' . 'list-style-position:inside;' . 'padding:0 0 0 24px;' . '}' . 'li { cursor:pointer; }' . '</style>');
}
if ($display_type == 'microthumbs') {
wppa_out('<style scoped="scoped" >' . 'img {' . 'max-width:100px;' . 'max-height:50px;' . 'padding:1px;' . 'margin:1px;' . 'background-color:' . wppa_opt('bgcolor_img') . ';' . 'float:left;' . '}' . '</style>');
}
}
// Start list if required
if ($is_list) {
wppa_out('<ul class="wppa-cover-sublink-list" style="clear:both;" >');
} else {
wppa_out('<div style="clear:both;" ></div>');
}
// Process the sub-albums
foreach ($subs as $album) {
// What is the albums title linktype
$linktype = $album['cover_linktype'];
if (!$linktype) {
$linktype = 'content';
}
// Default
// What is the albums title linkpage
$linkpage = $album['cover_linkpage'];
if ($linkpage == '-1') {
$linktype = 'none';
}
// for backward compatibility
// Find the content 'View' link
$albumid = $album['id'];
$photocount = wppa_get_photo_count($albumid, 'use_treecounts');
// Thumbnails and covers, show sub-album covers
// in case slideshow is requested on an empty album
if (wppa_opt('cover_sublinks') == 'content' || !$photocount) {
if (wppa_switch('allow_ajax') && !$linkpage) {
$href_content = '';
$onclick_content = "wppaDoAjaxRender( " . wppa('mocc') . ", '" . wppa_get_album_url_ajax($albumid, $linkpage) . "', '" . wppa_convert_to_pretty($href_content) . "' )";
} else {
$href_content = wppa_convert_to_pretty(wppa_get_album_url($albumid, $linkpage));
$onclick_content = '';
}
} else {
if (wppa_switch('allow_ajax') && !$linkpage) {
$href_content = '';
$onclick_content = "wppaDoAjaxRender( " . wppa('mocc') . ", '" . wppa_get_slideshow_url_ajax($albumid, $linkpage) . "', '" . wppa_convert_to_pretty($href_content) . "' )";
} else {
$href_content = wppa_convert_to_pretty(wppa_get_slideshow_url($albumid, $linkpage));
$onclick_content = '';
}
}
// Do the output
$title = esc_attr(__('View the album', 'wp-photo-album-plus') . ': ' . wppa_get_album_name($album['id']));
switch ($display_type) {
case 'list':
case 'recursivelist':
if ($link_type == 'none') {
wppa_out('<li>' . wppa_get_album_name($album['id']) . '</li>');
} else {
wppa_out('<li>' . '<a' . ($href_content ? ' href="' . $href_content . '"' : '') . ($onclick_content ? ' onclick="' . $onclick_content . '"' : '') . ' title="' . $title . '"' . ' >' . wppa_get_album_name($album['id']) . '</a>' . '</li>');
}
break;
case 'enum':
if (!$first) {
wppa_out(', ');
}
if ($link_type == 'none') {
wppa_out(wppa_get_album_name($album['id']));
} else {
wppa_out('<a' . ($href_content ? ' href="' . $href_content . '"' : '') . ($onclick_content ? ' onclick="' . $onclick_content . '"' : '') . ' title="' . $title . '"' . ' >' . wppa_get_album_name($album['id']) . '</a>');
}
$first = false;
break;
case 'microthumbs':
$coverphoto_id = wppa_get_coverphoto_id($album['id']);
$src = wppa_fix_poster_ext(wppa_get_thumb_url($coverphoto_id), $coverphoto_id);
if ($link_type == 'none') {
wppa_out('<img' . ' class="wppa-cover-sublink-img"' . ' src="' . $src . '"' . ' alt="' . wppa_get_album_name($album['id']) . '"' . ' />');
} else {
wppa_out('<a' . ($href_content ? ' href="' . $href_content . '"' : '') . ($onclick_content ? ' onclick="' . $onclick_content . '"' : '') . ' title="' . $title . '"' . ' >' . '<img' . ' class="wppa-cover-sublink-img"' . ' src="' . $src . '"' . ' alt="' . wppa_get_album_name($album['id']) . '"' . ' />' . '</a>');
//.........这里部分代码省略.........
开发者ID:msayagh,项目名称:Quercus-source-code-Maven,代码行数:101,代码来源:wppa-album-covers.php
示例12: 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':
//.........这里部分代码省略.........
|
请发表评论