• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

PHP generate_thumb函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中generate_thumb函数的典型用法代码示例。如果您正苦于以下问题:PHP generate_thumb函数的具体用法?PHP generate_thumb怎么用?PHP generate_thumb使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了generate_thumb函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: plogger_get_album_thumb

function plogger_get_album_thumb()
{
    $rv = $GLOBALS["current_album"];
    // figure out the thumbnail as well
    $thumb_query = "SELECT * FROM `" . TABLE_PREFIX . "pictures` WHERE ";
    if ($rv["thumbnail_id"] > 0) {
        $thumb_query .= " `id`=" . $rv["thumbnail_id"];
    } else {
        $thumb_query .= " `parent_album`='" . $rv["id"] . "' ORDER BY `date_submitted` DESC LIMIT 1";
    }
    $thumb_result = run_query($thumb_query);
    $thumb_data = mysql_fetch_assoc($thumb_result);
    if ($thumb_data) {
        $rv["thumbnail_id"] = $thumb_data["id"];
        $rv["thumbnail_path"] = $thumb_data["path"];
    }
    return generate_thumb($rv['thumbnail_path'], $rv['thumbnail_id'], THUMB_SMALL);
}
开发者ID:alanhaggai,项目名称:plogger,代码行数:18,代码来源:plog-functions.php


示例2: get_files

<?php

// this will create a picture thumbnail on disk
// first it will be used for import only.
if (empty($_GET["img"])) {
    return "No such image";
}
require_once "../plog-functions.php";
require_once "../plog-globals.php";
require_once "../plog-load_config.php";
require_once "plog-admin-functions.php";
$files = get_files($config['basedir'] . 'uploads');
$found = false;
$up_dir = $config['basedir'] . 'uploads';
foreach ($files as $file) {
    if (md5($file) == $_GET["img"]) {
        $found = true;
        $rname = substr($file, strlen($up_dir) + 1);
        $thumbpath = generate_thumb($up_dir . '/' . $rname, "import", THUMB_SMALL);
        print '<img src="' . $thumbpath . '" /></div>';
        //print "found $relative_name!";
        break;
    }
}
开发者ID:alanhaggai,项目名称:plogger,代码行数:24,代码来源:plog-thumb.php


示例3: get_picture_by_id

<?php 
require_once "plog-admin.php";
require_once "../plog-load_config.php";
// load configuration variables from database
require_once "../plog-functions.php";
// this script will just show a small preview of the thumbnail in admin view if
// you can't differentiate the small pics.
echo '<html><head>

<body>';
$src = $_REQUEST['src'];
$picture = get_picture_by_id($src);
$id = $picture["id"];
$thumbpath = generate_thumb($picture["path"], $picture["id"], THUMB_LARGE);
$thumbdir = $config["basedir"] . "thumbs/lrg-{$id}-" . basename($picture["path"]);
list($width, $height, $type, $attr) = getimagesize($thumbdir);
// print $thumbdir;
echo '
<script language="JavaScript">
<!--
this.resizeTo(' . $width . '+25,' . $height . '+70);
this.moveTo((screen.width-' . $width . ')/2, (screen.height-' . $height . ')/2);
-->
</script>';
// generate XHTML with thumbnail and link to picture view.
$imgtag = '<img class="photos" src="' . $thumbpath . '" alt="' . $src . '"/>';
$output = $imgtag;
?>

<html>
开发者ID:alanhaggai,项目名称:plogger,代码行数:30,代码来源:plog-thumbpopup.php


示例4: generate_thumb

    if (is_file($meta_file)) {
        // Pull in meta information
        include $meta_file;
        if ($counter % 2 == 0) {
            $table_row_color = 'color-1';
        } else {
            $table_row_color = 'color-2';
        }
        // Generate small preview thumb, update thumb if preview.png has been updated
        $timestamp = @filemtime($theme_dir . $theme_folder_basename . '/preview.png');
        $thumbnail_config[THUMB_THEME]['timestamp'] = $timestamp;
        $thumbnail_config[THUMB_THEME]['size'] = 150;
        $preview_thumb = generate_thumb($theme_folder_name . 'preview.png', $theme_name, THUMB_THEME);
        // Generate large Lightbox preview thumb, update thumb if preview.png has been updated
        $thumbnail_config[THUMB_THEME]['size'] = 500;
        $preview_thumb_large = generate_thumb($theme_folder_name . 'preview.png', $theme_name . '-large', THUMB_THEME);
        // Start a new table row (alternating colors)
        if ($config['theme_dir'] == $theme_folder_basename) {
            $table_class = 'activated';
        } else {
            $table_class = $table_row_color;
        }
        $output .= "\n\t\t\t" . '<tr class="' . $table_class . '">';
        $output .= "\n\t\t\t\t" . '<td class="width-175">';
        if ($preview_thumb) {
            $output .= '<div class="img-shadow"><a rel="lightbox" href="' . $preview_thumb_large . '"><img src="' . $preview_thumb . '" alt="' . $theme_name . '" /></a></div>';
        }
        $output .= '</td>
				<td class="align-left width-100"><strong>' . $theme_name . '</strong><br />Version ' . $version . '</td>
				<td style="padding-right: 50px;">' . $description . '<br />&bull; ' . plog_tr('Released under the') . ' ' . $license . '.</td>
				<td class="align-left width-100"><a href="' . $url . '">' . $author . '</a></td>';
开发者ID:joshuasiler,项目名称:Rebuilding-Together,代码行数:31,代码来源:plog-themes.php


示例5: dirname

require_once dirname(dirname(__FILE__)) . '/plog-load-config.php';
require PLOGGER_DIR . 'plog-admin/plog-admin.php';
require_once PLOGGER_DIR . 'plog-admin/plog-admin-functions.php';
// This script will just show a small preview of the thumbnail in admin view if
// you can't differentiate the small pics.
echo '
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
	"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>

<body>';
$src = $_REQUEST['src'];
$picture = get_picture_by_id($src);
$id = $picture['id'];
$thumbpath = generate_thumb($picture['path'], $picture['id'], THUMB_LARGE);
$thumbdir = $config['basedir'] . 'plog-content/thumbs/lrg-$id-' . basename($picture['path']);
list($width, $height, $type, $attr) = getimagesize($thumbdir);
echo '
<script type="text/javascript">
<!--
this.resizeTo(' . $width . '+25,' . $height . '+70);
this.moveTo((screen.width-' . $width . ')/2, (screen.height-' . $height . ')/2);
-->
</script>';
// Generate XHTML with thumbnail and link to picture view
$imgtag = '<img class="photos" src="' . $thumbpath . '" alt="' . $src . '" />';
?>

<?php 
echo $imgtag;
开发者ID:nadams810,项目名称:ploto,代码行数:31,代码来源:plog-thumbpopup.php


示例6: intval

<?php

// This is mostly an interface for the XML service to get thumbnail URLs
// without having to generate the thumb at the time that the URL is
// needed.
require "plog-functions.php";
require "plog-globals.php";
/**
 * plog-thumb.php interface for XML service
 *
 * Purpose: Provide a link to a thumbnail for a picture even when the thumbnail
 * may not have been generated yet.
 *
 * @param int id (required)
 * @param int type (default 1, any of 1,2,3,4)
 */
if (!isset($_REQUEST["id"]) || intval($_REQUEST["id"]) == 0) {
    exit;
}
if (!isset($_REQUEST["type"])) {
    $_REQUEST["type"] = 1;
}
$query = "SELECT\r\n\t\t`path`,\r\n\t\t`id`\r\n\tFROM `plogger_pictures`\r\n\tWHERE `id`=" . intval($_REQUEST["id"]);
$result = run_query($query);
$thumb = mysql_fetch_assoc($result);
$thumb["type"] = intval($_REQUEST["type"]);
$path = generate_thumb($thumb["path"], $thumb["id"], $thumb["type"]);
header("Location: " . $path);
exit;
开发者ID:alanhaggai,项目名称:plogger,代码行数:29,代码来源:plog-thumb.php


示例7: intval

*
* Purpose: Provide a link to a thumbnail for a picture even when the thumbnail
* may not have been generated yet.
*
* @param int id (required)
* @param int type (default 1, any of 1,2,3,4)
*/
if (!isset($_REQUEST['id']) || intval($_REQUEST['id']) == 0) {
    exit;
}
if (!isset($_REQUEST['type'])) {
    $_REQUEST['type'] = 1;
}
$query = "SELECT `path`, `id` FROM `plogger_pictures` WHERE `id`=" . intval($_REQUEST['id']);
$result = run_query($query);
$thumb = mysqli_fetch_assoc($result);
$thumb['type'] = intval($_REQUEST['type']);
$path = generate_thumb($thumb['path'], $thumb['id'], $thumb['type']);
// Make sure the generated url and the browser url have the same domain syntax
$browser_www = strpos($_SERVER['HTTP_HOST'], 'www');
$thumb_www = strpos($path, 'www');
if ($browser_www !== $thumb_www) {
    if ($browser_www === false) {
        $path = str_replace('www', '', $path);
    } else {
        $path = str_replace('//', '//www.', $path);
    }
}
close_db();
header('Location: ' . $path);
exit;
开发者ID:nadams810,项目名称:ploto,代码行数:31,代码来源:plog-thumb.php


示例8: plog_edit_album_form

function plog_edit_album_form($album_id)
{
    global $config, $thumbnail_config;
    $album_id = intval($album_id);
    $album = get_album_by_id($album_id);
    $auto_graphic = $config['gallery_url'] . 'plog-admin/images/auto.gif';
    $page = isset($_GET['plog_page']) ? '&amp;plog_page=' . intval($_GET['plog_page']) : '';
    $output = "\n\t\t" . '<form class="edit width-700" action="' . $_SERVER['PHP_SELF'] . '?level=albums&amp;id=' . $album['parent_id'] . $page . '" method="post">';
    $images = '<option class="thumboption" value="0" style="padding-left: 100px; background-image: url(' . $auto_graphic . ');">' . plog_tr('automatic') . '</option>';
    $sql = "SELECT id, caption, path FROM " . PLOGGER_TABLE_PREFIX . "pictures p WHERE p.parent_album = '" . $album_id . "'";
    $result = run_query($sql);
    while ($row = $result->fetch()) {
        $selected = $row['id'] == $album['thumbnail_id'] ? ' selected="selected"' : '';
        $style = 'class="thumboption" style="padding-left: ' . ($thumbnail_config[THUMB_SMALL]['size'] + 5) . 'px; background-image: url(' . generate_thumb(SmartStripSlashes($row['path']), $row['id']) . ');"';
        $images .= "\n\t\t\t\t" . '<option ' . $style . ' value="' . $row['id'] . '"' . $selected . '>';
        $images .= !empty($row['caption']) ? SmartStripSlashes($row['caption']) : SmartStripSlashes(basename($row['path']));
        $images .= "</option>";
    }
    $output .= "\n\t\t\t" . '<div>
				<div class="strong">' . plog_tr('Edit Album Properties') . '</div>
				<p>
					<label class="strong" for="name" accesskey="n">' . plog_tr('<em>N</em>ame') . ':</label><br />
					<input size="61" name="name" id="name" value="' . htmlspecialchars(SmartStripSlashes($album['name'])) . '" />
				</p>
				<p>
					<label class="strong" for="description" accesskey="d">' . plog_tr('<em>D</em>escription') . ':</label><br />
					<input size="61" name="description" id="description" value="' . htmlspecialchars(SmartStripSlashes($album['description'])) . '" />
				</p>
				<p>
					<span class="strong">Thumbnail:</span><br />
					<select name="thumbnail_id" class="thumbselect width-450" id="thumbselect" onchange="updateThumbPreview(this)">' . $images . '
					</select>
					<script type="text/javascript">updateThumbPreview(document.getElementById(\'thumbselect\'));</script>
				</p>
				<input type="hidden" name="pid" value="' . $album_id . '" />
				<input type="hidden" name="action" value="update-album" />
				<input class="submit" name="update" value="' . plog_tr('Update') . '" type="submit" />
				<input class="submit-cancel" name="cancel" value="' . plog_tr('Cancel') . '" type="submit" />
			</div>
		</form>' . "\n";
    return $output;
}
开发者ID:BogusCurry,项目名称:plogger-pdo,代码行数:42,代码来源:plog-admin-functions.php


示例9: get_picture_by_id

     $table_row_color = "color-1";
 } else {
     $table_row_color = "color-2";
 }
 // start a new table row (alternating colors)
 $output .= "<tr class=\"{$table_row_color}\">";
 // give the row a checkbox
 $output .= '<td width="15"><input type="CHECKBOX" name="Selected[]" VALUE="' . $row["id"] . '"></td>';
 // give the row a thumbnail, we need to look up the parent picture for the comment
 $picture = get_picture_by_id($row["parent_id"]);
 $thumbpath = generate_thumb($picture["path"], $picture["id"], THUMB_SMALL);
 // generate XHTML with thumbnail and link to picture view.
 $imgtag = '<div class="img-shadow"><img src="' . $thumbpath . '" title="' . $picture["caption"] . '" alt="' . $picture["caption"] . '" /></div>';
 //$target = 'plog-thumbpopup.php?src='.$picture["id"];;
 //$java = "javascript:this.ThumbPreviewPopup('$target')";
 $output .= '<td><a href="' . generate_thumb($picture["path"], $picture["id"], THUMB_LARGE) . '" rel="lightbox" title="' . plogger_get_picture_caption() . '">' . $imgtag . '</a></td>';
 foreach ($row as $key => $value) {
     $value = htmlspecialchars($value);
     $value = SmartStripSlashes($value);
     if ($key == "unix_date") {
         $output .= '<td>' . date($config["date_format"], $value) . '</td>';
     } else {
         if ($key == "allow_comments") {
             if ($value) {
                 $output .= "<td>" . plog_tr('Yes') . "</td>";
             } else {
                 $output .= "<td>" . plog_tr('No') . "</td>";
             }
         } else {
             if (in_array($key, $allowedCommentKeys)) {
                 $output .= "<td><p id=\"comment-{$key}-" . $row[id] . "\">{$value}&nbsp;</p></td>";
开发者ID:alanhaggai,项目名称:plogger,代码行数:31,代码来源:plog-feedback.php


示例10: list

     $err = NULL;
     // Short error code
     list($src_width, $src_height) = imgsize($File->get_full_path());
     if (!$resample_all_images && check_thumbnail_sizes($thumb_type, $thumb_width, $thumb_height, $src_width, $src_height)) {
         // There is no need to resample, use original!
         $err = $File->get_af_thumb_path($size_name, $mimetype, true, $size_x);
         if ($err[0] != '!' && @copy($File->get_full_path(), $err)) {
             // File was saved. Ouput that same file immediately:
             // note: @copy returns FALSE on failure, if not muted it'll print the error on screen
             $err = $File->output_cached_thumb($size_name, $mimetype, $mtime, $size_x);
         }
     } else {
         // Resample
         list($err, $src_imh) = load_image($File->get_full_path(), $mimetype);
         if (empty($err)) {
             list($err, $dest_imh) = generate_thumb($src_imh, $thumb_type, $thumb_width, $thumb_height, $thumb_percent_blur, $size_x);
             if (empty($err)) {
                 $err = $File->save_thumb_to_cache($dest_imh, $size_name, $mimetype, $thumb_quality, $size_x);
                 if (empty($err)) {
                     // File was saved. Ouput that same file immediately:
                     // This is probably better than recompressing the memory image..
                     $err = $File->output_cached_thumb($size_name, $mimetype, $mtime, $size_x);
                 } else {
                     // File could not be saved.
                     // fp> We might want to output dynamically...
                     // $err = output_image( $dest_imh, $mimetype );
                 }
             }
         }
     }
 }
开发者ID:Ariflaw,项目名称:b2evolution,代码行数:31,代码来源:getfile.php


示例11: umask

     continue;
 }
 if (!is_dir($realdir . $delim . $thumbdir)) {
     $u = umask(0);
     if (is_writable($realdir) !== TRUE) {
         chmod($realdir, 0777);
     }
     if (!@mkdir($realdir . $delim . $thumbdir, 0777)) {
         echo '<p style="color: red; text-align: center">' . word('mkdir_error') . '</span>';
         break;
     }
     umask($u);
 }
 $thumb = $realdir . $delim . $thumbdir . $delim . $filename . '.thumb.jpg';
 if (!is_file($thumb) || filemtime($file) > filemtime($thumb)) {
     generate_thumb($thumb, $file);
 }
 if ($filenames) {
     echo '<div>';
 }
 if ($included && $inline) {
     echo '<a href="?';
     if (array_key_exists('dir', $_REQUEST)) {
         echo 'dir=' . urlencode($_REQUEST['dir']) . '&amp;';
     }
     echo 'pic=' . $i . html($urlsuffix);
 } else {
     echo '<a href="' . html("{$dirnamehttp}/{$filename}");
 }
 echo '"><img src="' . html("{$dirnamehttp}/{$thumbdir}/{$filename}.thumb.jpg");
 echo '" alt="' . html($filename) . '" style="';
开发者ID:jfyuen,项目名称:galerie,代码行数:31,代码来源:galerie.php


示例12: thumbnail

 /**
  * This will spit out a content-type header followed by a thumbnail for this file.
  *
  * @todo a million things (fp) but you get the idea...
  * The generated thumb will be saved to a cached file here (fp)
  * The cache will be accessed through the File object (fp)
  * @todo cleanup memory resources
  *
  * @param string requested size: 'thumbnail'
  */
 function thumbnail($req_size)
 {
     load_funcs('/files/model/_image.funcs.php');
     $size_name = $req_size;
     switch ($req_size) {
         case 'fit-720x500':
             $thumb_width = 720;
             $thumb_height = 500;
             $thumb_quality = 90;
             break;
         case 'fit-640x480':
             $thumb_width = 640;
             $thumb_height = 480;
             $thumb_quality = 90;
             break;
         case 'fit-400x320':
             $thumb_width = 400;
             $thumb_height = 320;
             $thumb_quality = 85;
             break;
         case 'fit-320x320':
             $thumb_width = 320;
             $thumb_height = 320;
             $thumb_quality = 85;
             break;
         case 'fit-80x80':
         default:
             $size_name = 'fit-80x80';
             $thumb_width = 80;
             $thumb_height = 80;
             $thumb_quality = 75;
     }
     $mimetype = $this->Filetype->mimetype;
     // Try to output the cached thumbnail:
     $err = $this->output_cached_thumb($size_name, $mimetype);
     if ($err == '!Thumbnail not found in .evocache') {
         // The thumbnail wasn't already in the cache, try to generate and cache it now:
         $err = NULL;
         // Short error code
         list($err, $src_imh) = load_image($this->get_full_path(), $mimetype);
         if (empty($err)) {
             list($err, $dest_imh) = generate_thumb($src_imh, $thumb_width, $thumb_height);
             if (empty($err)) {
                 $err = $this->save_thumb_to_cache($dest_imh, $size_name, $mimetype, $thumb_quality);
                 if (empty($err)) {
                     // File was saved. Ouput that same file immediately:
                     // This is probably better than recompressing the memory image..
                     $err = $this->output_cached_thumb($size_name, $mimetype);
                 } else {
                     // File could not be saved.
                     // fp> We might want to output dynamically...
                     // $err = output_image( $dest_imh, $mimetype );
                 }
             }
         }
     }
     // ERROR IMAGE
     if (!empty($err)) {
         // Generate an error image and try to squeeze an error message inside:
         // Note: we write small and close to the upper left in order to have as much text as possible on small thumbs
         $err = substr($err, 1);
         // crop 1st car
         $car_width = ceil(($thumb_width - 4) / 6);
         // $err = 'w='.$car_width.' '.$err;
         $err = wordwrap($err, $car_width, "\n");
         $err = split("\n", $err);
         // split into lines
         $im_handle = imagecreatetruecolor($thumb_width, $thumb_height);
         // Create a black image
         $text_color = imagecolorallocate($im_handle, 255, 0, 0);
         $y = 0;
         foreach ($err as $err_string) {
             imagestring($im_handle, 2, 2, $y, $err_string, $text_color);
             $y += 11;
         }
         header('Content-type: image/png');
         imagepng($im_handle);
     }
 }
开发者ID:LFSF,项目名称:oras,代码行数:89,代码来源:_file.class.php


示例13: dirname

<?php

// This will create a picture thumbnail on disk
// First it will be used for import only.
// Load configuration variables from database, plog-globals, & plog-includes/plog-functions
require_once dirname(dirname(__FILE__)) . '/plog-load-config.php';
require_once PLOGGER_DIR . 'plog-admin/plog-admin-functions.php';
// Set up the default error message
$found = plog_tr('No such image');
if (empty($_GET['img'])) {
    exit($found);
}
$files = get_files(PLOGGER_DIR . 'plog-content/uploads');
$up_dir = PLOGGER_DIR . 'plog-content/uploads';
foreach ($files as $file) {
    if (md5($file) == $_GET['img']) {
        $rname = substr($file, strlen($up_dir) + 1);
        $thumbpath = generate_thumb($up_dir . '/' . $rname, 'import-' . substr(md5($file), 0, 2), THUMB_SMALL);
        $found = '<img src="' . $thumbpath . '" alt="" /></div>';
        //echo "found $relative_name!";
        break;
    }
}
close_db();
close_ftp();
echo $found;
开发者ID:nadams810,项目名称:ploto,代码行数:26,代码来源:plog-thumb.php


示例14: plogger_get_album_thumb

function plogger_get_album_thumb()
{
    $rv = $GLOBALS['current_album'];
    // Figure out the thumbnail as well
    $thumb_query = "SELECT * FROM \"" . PLOGGER_TABLE_PREFIX . "pictures\" WHERE ";
    if ($rv['thumbnail_id'] > 0) {
        $thumb_query .= " \"id\"=" . $rv['thumbnail_id'];
    } else {
        $thumb_query .= " \"parent_album\"='" . $rv['id'] . "' ORDER BY \"date_submitted\" DESC LIMIT 1";
    }
    $thumb_result = run_query($thumb_query);
    $thumb_data = $thumb_result->fetch();
    if ($thumb_data) {
        $rv['thumbnail_id'] = $thumb_data['id'];
        $rv['thumbnail_path'] = $thumb_data['path'];
    }
    return generate_thumb($rv['thumbnail_path'], $rv['thumbnail_id'], THUMB_SMALL);
}
开发者ID:BogusCurry,项目名称:plogger-pdo,代码行数:18,代码来源:plog-functions.php


示例15: mysqli_query

/* The database query to pull random images from a specific collection. Uncomment and change the X to the ID of the desired collection. */
//$plog_random_images_query = "SELECT * FROM ".PLOGGER_TABLE_PREFIX."pictures WHERE `parent_collection` = X ORDER BY RAND() LIMIT $plog_random_images_amount";
$plog_random_images_result = mysqli_query($GLOBALS["PLOGGER_DBH"], $plog_random_images_query) or die("Could not execute query: {$plog_random_images_query}." . mysqli_error($GLOBALS["PLOGGER_DBH"]));
$config['baseurl'] = $plog_random_images_site_url;
/* The loop */
while ($row = mysqli_fetch_array($plog_random_images_result)) {
    $id = $row['id'];
    $path = $row['path'];
    $caption = SmartStripSlashes($row['caption']);
    $name = substr(basename($row['path']), 0, strrpos(basename($row['path']), '.'));
    $cap_or_name = !empty($caption) ? $caption : $name;
    ?>
	<a href="<?php 
    echo generate_url('picture', $id);
    ?>
" title="<?php 
    echo addcslashes($cap_or_name, '"');
    ?>
"><img class="random-images-thumbnail" src="<?php 
    echo generate_thumb($path, $id);
    ?>
" alt="<?php 
    echo $name;
    ?>
" /></a><br />
	<p class="random-images-caption"><?php 
    echo $caption;
    ?>
</p>
<?php 
}
开发者ID:nadams810,项目名称:ploto,代码行数:31,代码来源:random-images.php


示例16: thumb

 $thumburl = thumb($image, array('width' => $thumbwidth, 'quality' => $quality, 'crop' => $crop), false);
 if ($multisizes == true) {
     $ms_datasrcset = "";
     if ($thumbwidth > 300) {
         $ms_datasrcset .= generate_thumb($image, $quality, $crop, 300);
     }
     if ($thumbwidth > 600) {
         $ms_datasrcset .= generate_thumb($image, $quality, $crop, 600);
     }
     if ($thumbwidth > 1200) {
         $ms_datasrcset .= generate_thumb($image, $quality, $crop, 1200);
     }
     if ($thumbwidth > 1600) {
         $ms_datasrcset .= generate_thumb($image, $quality, $crop, 1600);
     }
     $ms_datasrcset .= generate_thumb($image, $quality, $crop, $thumbwidth);
 }
 if ($feed == true) {
     $imagethumb = html::img($thumburl, array('class' => $class, 'alt' => html($alt)));
     $noscript = false;
 }
 // [1] Regular image; resized thumb (e.g. thumbs.width.default)
 if ($lazyload == false) {
     if ($multisizes == true) {
         $imagethumb = html::img($thumburl, array('data-sizes' => "auto", 'data-srcset' => $ms_datasrcset, 'class' => $class . ' lazyload', 'alt' => html($alt)));
     } else {
         $imagethumb = html::img($thumburl, array('class' => $class, 'alt' => html($alt)));
     }
     $noscript = false;
 }
 $placeholderSRC = 'data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==';
开发者ID:arnaudjuracek,项目名称:www-boite-noire,代码行数:31,代码来源:image.php


示例17: substr

            $relative_name = substr($files[$i], strlen($upload_directory) + 1);
            if ($i == 0) {
                $output .= "\n\t\t\t" . '<form id="uploadForm" action="' . $_SERVER["PHP_SELF"] . $query . '" method="post" enctype="multipart/form-data">
			<table style="width: 100%;" cellpadding="3" cellspacing="0">
				<tr class="header">
					<th class="table-header-left align-center width-15"><input name="allbox" type="checkbox" onclick="checkAll(document.getElementById(\'uploadForm\'));" checked="checked" /></th>
					<th class="table-header-middle align-left width-175" style="text-indent: 40px;">' . plog_tr('Thumb') . '</th>
					<th class="table-header-middle align-left width-200" style="text-align: left;">' . plog_tr('Filename') . '</th>
					<th class="table-header-middle align-left">' . plog_tr('Caption &amp; Description (optional)') . '</th>
					<th class="table-header-right width-125">' . $comment . '</th>
				</tr>';
            }
            // For each file within upload directory, list checkbox, thumbnail, caption box, description box, allow comments checkbox
            $table_row_color = $counter % 2 ? 'color-1' : 'color-2';
            if (isset($_GET['nojs'])) {
                $thumbpath = generate_thumb($upload_directory . '/' . $relative_name, 'import-' . substr($file_key, 0, 2), THUMB_SMALL);
            } else {
                $thumbpath = $config['gallery_url'] . 'plog-admin/images/ajax-loader.gif';
            }
            // Start a new table row (alternating colors) and generate XHTML with thumbnail and link to picture view.
            $output .= "\n\t\t\t\t" . '<tr class="' . $table_row_color . '">
					<td class="align-center width-15"><p class="margin-5"><input type="checkbox" name="selected[]" value="' . $file_key . '" checked="checked" /></p></td>
					<td class="align-left width-175"><div class="img-shadow" id="pic_' . $file_key . '"><img src="' . $thumbpath . '" alt="thumbnail" /></div></td>
					<td class="align-left width-200 vertical-top">' . basename($files[$i]) . '</td>
					<td class="align-left vertical-top">
						<input type="text" size="60" style="width: 95%;" name="captions[' . $file_key . ']" /><br />
						<textarea name="descriptions[' . $file_key . ']" rows="4" cols="60" style="width: 95%;"></textarea>
					</td>
					<td class="align-center width-125"><input type="' . $comment_type . '" name="allow_comments[]" value="' . $file_key . '" /></td>
				</tr>';
            $counter++;
开发者ID:nadams810,项目名称:ploto,代码行数:31,代码来源:plog-import.php


示例18: upgrade_images

function upgrade_images($num, $list)
{
    $output = array();
    $errors = array();
    $count = 0;
    $list = array_slice($list, 0, $num);
    foreach ($list as $image) {
        if (!empty($image['id'])) {
            // Work on the images - move physical file, create directory if necessary and update path in database
            if (!makeDirs(PLOGGER_DIR . 'plog-content/images/' . dirname($image['new_path'] . '/'))) {
                $errors[] = plog_tr('Could not create directory') . ': ' . PLOGGER_DIR . 'plog-content/images/' . $image['new_path'];
            } else {
                if (!move_this(PLOGGER_DIR . $image['old_path'], PLOGGER_DIR . 'plog-content/images/' . $image['new_path'])) {
                    $errors[] = plog_tr('Could not move file') . ': ' . PLOGGER_DIR . $image['old_path'];
                } else {
                    @chmod(PLOGGER_DIR . $new_path, PLOGGER_CHMOD_DIR);
                    $output[] = sprintf(plog_tr('Moved file %s -> %s'), '<strong>' . $image['old_path'] . '</strong>', '<strong>' . 'plog-content/images/' . $image['new_path'] . '</strong>');
                    // Update database
                    $sql = "UPDATE " . PLOGGER_TABLE_PREFIX . "pictures SET path = '" . mysql_real_escape_string($image['new_path']) . "' WHERE id = '" . $image['id'] . "'";
                    run_query($sql);
                    // Generate a new small thumbnail after database has been updated in case script times out
                    $thumbpath = generate_thumb($image['new_path'], $image['id'], THUMB_SMALL);
                    $count++;
                }
            }
        } else {
            if (!empty($image['uploads'])) {
                // Work on the uploads - move physical file and create directory in the uploads folder if necessary and update path in database
                if (!makeDirs(PLOGGER_DIR . dirname($image['new_path'] . '/'))) {
                    $errors[] = plog_tr('Could not create directory') . ': ' . PLOGGER_DIR . $image['new_path'];
                } else {
                    if (!move_this(PLOGGER_DIR . $image['old_path'], PLOGGER_DIR . $image['new_path'])) {
                        $errors[] = plog_tr('Could not move file') . ': ' . PLOGGER_DIR . $image['old_path'];
                    } else {
                        @chmod(PLOGGER_DIR . $new_path, PLOGGER_CHMOD_DIR);
                        $output[] = sprintf(plog_tr('Moved file %s -> %s'), '<strong>' . $image['old_path'] . '</strong>', '<strong>' . $image['new_path'] . '</strong>');
                        $count++;
                    }
                }
            } else {
                if (!empty($image['container'])) {
                    // Create the collection and album directory structure
                    if (!makeDirs(PLOGGER_DIR . $image['new_path'] . '/')) {
                        $errors[] = plog_tr('Could not create directory') . ': ' . PLOGGER_DIR . $image['new_path'];
                    } else {
                        $output[] = sprintf(plog_tr('Created directory %s'), '<strong>' . $image['new_path'] . '</strong>');
                        $count++;
                    }
                }
            }
        }
    }
    return array('errors' => $errors, 'output' => $output, 'count' => $count);
}
开发者ID:joshuasiler,项目名称:Rebuilding-Together,代码行数:54,代码来源:install-functions.php


示例19: get_picture_by_id

            }
            if ($counter % 2 == 0) {
                $table_row_color = 'color-1';
            } else {
                $table_row_color = 'color-2';
            }
            // Start a new table row (alternating colors)
            $output .= "\n\t\t\t" . '<tr class="' . $table_row_color . '">';
            // Give the row a checkbox
            $output .= "\n\t\t\t\t" . '<td class="align-center width-15"><p class="margin-5"><input type="checkbox" name="selected[]" value="' . $row['id'] . '" /></p></td>';
            // Give the row a thumbnail, we need to look up the parent picture for the comment
            $picture = get_picture_by_id($row['parent_id']);
            $thumbpath = generate_thumb($picture['path'], $picture['id'], THUMB_SMALL);
            // Generate XHTML with thumbnail and link to picture view.
            $imgtag = '<img src="' . $thumbpath . '" title="' . htmlspecialchars(strip_tags($picture['caption']), ENT_QUOTES) . '" alt="' . htmlspecialchars(strip_tags($picture['caption']), ENT_QUOTES) . '" />';
            $output .= "\n\t\t\t\t" . '<td class="align-center width-150"><div class="img-shadow"><a href="' . generate_thumb($picture['path'], $picture['id'], THUMB_LARGE) . '" rel="lightbox" title="' . htmlspecialchars($picture['caption'], ENT_QUOTES) . '">' . $imgtag . '</a></div></td>';
            // Author / Email / Website
            $output .= "\n\t\t\t\t" . '<td class="align-left width-175">
					<p class="margin-5 no-margin-bottom"><strong>' . plog_tr('Author') . ':</strong></p>
					<p class="margin-5 no-margin-top" id="comment-author-' . $row['id'] . '">' . $row['author'] . '</p>
					<p class="margin-5 no-margin-bottom"><strong>' . plog_tr('Email') . ':</strong></p>
					<p class="margin-5 no-margin-top" id="comment-email-' . $row['id'] . '">' . $row['email'] . '</p>
					<p class="margin-5 no-margin-bottom"><strong>' . plog_tr('Website') . ':</strong></p>
					<p class="margin-5 no-margin-top" id="comment-url-' . $row['id'] . '">' . $row['url'] . '</p>
				</td>';
            // Date
            $output .= "\n\t\t\t\t" . '<td class="align-left width-100"><p class="margin-5">' . date($config['date_format'], $row['date']) . '</p></td>';
            // Comment
            $output .= "\n\t\t\t\t" . '<td class="align-left vertical-top"><p class="margin-5" id="comment-comment-' . $row['id'] . '">' . $row['comment'] . '</p></td>';
            // Actions panel
            $query = "?action=edit-comment&amp;pid={$row['id']}";
开发者ID:joshuasiler,项目名称:Rebuilding-Together,代码行数:31,代码来源:plog-feedback.php


示例20: prepare_uploaded_image

/**
 * Prepare image file (Resize, Rotate and etc.)
 *
 * @param object File
 * @param string mimetype
 */
function prepare_uploaded_image($File, $mimetype)
{
    global $Settings, $Messages;
    $thumb_width = $Settings->get('fm_resize_width');
    $thumb_height = $Settings->get('fm_resize_height');
    $thumb_quality = $Settings->get('fm_resize_quality');
    $do_resize = false;
    if ($Settings->get('fm_resize_enable') && $thumb_width > 0 && $thumb_height > 0) {
        // Image resizing is enabled
        list($image_width, $image_height) = explode('x', $File->get_image_size());
        if ($image_width > $thumb_width || $image_height > $thumb_height) {
            // This image should be resized
            $do_resize = true;
        }
    }
    load_funcs('files/model/_image.funcs.php');
    $resized_imh = null;
    if ($do_resize) {
        // Resize image
        list($err, $src_imh) = load_image($File->get_full_path(), $mimetype);
        if (empty($err)) {
            list($err, $resized_imh) = generate_thumb($src_imh, 'fit', $thumb_width, $thumb_height);
        }
        if (empty($err)) {
            // Image was rezised successfully
            $Messages->add(sprintf(T_('%s was resized to %dx%d pixels.'), '<b>' . $File->get('name') . '</b>', imagesx($resized_imh), imagesy($resized_imh)), 'success');
        } else {
            // Image was not rezised
            $Messages->add(sprintf(T_('%s could not be resized to target resolution of %dx%d pixels.'), '<b>' . $File->get('name') . '</b>', $thumb_width, $thumb_height), 'error');
            // Error exists, exit here
            return;
        }
    }
    if ($mimetype == 'image/jpeg') {
        // JPEG, do autorotate if EXIF Orientation tag is defined
        $save_image = !$do_resize;
        // If image was be resized, we should save file only in the end of this function
        exif_orientation($File->get_full_path(), $resized_imh, $save_image);
    }
    if (!$resized_imh) {
        // Image resource is incorrect
        return;
    }
    if ($do_resize 

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP generate_thumbnail函数代码示例发布时间:2022-05-15
下一篇:
PHP generate_text_for_storage函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap