示例#1
0
function makeThumbnail($filename, $location, $width = "", $height = "", $postfix = "")
{
    $filetype = substr($filename, strrpos($filename, ".") + 1);
    switch ($filetype) {
        case "jpg":
        case "jpeg":
            $image = imagecreatefromjpeg($location . $filename);
            break;
        case "gif":
            $image = imagecreatefromgif($location . $filename);
            break;
        case "png":
            $image = imagecreatefrompng($location . $filename);
            break;
        default:
            return FALSE;
    }
    list($imwidth, $imheight) = getimagesize($location . $filename);
    if ($width == "" && $height == "") {
        $newwidth = $imwidth;
        $newheight = $imheight;
    } else {
        if ($width != "" && $height == "") {
            $newwidth = $width;
            $newheight = $imheight * ($width / $imwidth);
        } else {
            if ($width == "" && $height != "") {
                $newwidth = $imwidth * ($height / $imheight);
                $newheight = $height;
            } else {
                $newwidth = $width;
                $newheight = $height;
            }
        }
    }
    $thumbimage = imagecreatetruecolor($newwidth, $newheight);
    imagecopyresampled($thumbimage, $image, 0, 0, 0, 0, $newwidth, $newheight, $imwidth, $imheight);
    imagejpeg($thumbimage, $location . getThumbnailFilename($filename, $postfix));
    return TRUE;
}
示例#2
0
function print_gallery_image_thumbs($galleryID, $display = "*", $type = "div")
{
    $sql = 'SELECT * FROM gallery_images WHERE gallery_id = ' . $galleryID . ' AND gallery_image_featured = 0 ORDER BY gallery_image_sort_order';
    $imgResults = dbQuery($sql);
    if (dbNumRows($imgResults)) {
        echo "<h1>Current Images</h1>\n";
        if ($type == "ul") {
            echo "<ul>\n";
            while ($img = dbFetchArray($imgResults)) {
                if ($img['gallery_image_featured'] == 1) {
                    $featured = " featured";
                } else {
                    $featured = "";
                }
                echo "<li class=\"sortableitem\"><a href=\"editimage.php?gallery=" . $galleryID . "&image_id=" . $img['gallery_image_id'] . "\" class=\"galleryThumb modal " . $featured . "\" ><img border=\"0\" src=\"" . UPLOAD_DIR_URL . getThumbnailFilename($img['gallery_image_filename'], 'thumb') . "\" class=\"gallery_img\" /></a></li>\n";
            }
            echo "</ul>\n";
        }
        if ($type == "div") {
            echo "<div id=\"gallery_current_images\" align=\"center\">";
            $featuredResults = dbQuery('SELECT * FROM gallery_images WHERE gallery_id = ' . $galleryID . ' AND gallery_image_featured = 1 ORDER BY gallery_image_sort_order');
            while ($feature = dbFetchArray($featuredResults)) {
                if ($feature['gallery_image_featured'] == 1) {
                    $featured = " featured";
                } else {
                    $featured = "";
                }
                echo "<div id=\"img_" . $img['gallery_image_id'] . "\" class=\"galeryImg featuredImg\">";
                echo "<a href=\"editimage.php?gallery=" . $galleryID . "&image_id=" . $feature['gallery_image_id'] . "\" class=\"galleryThumbFeatured modal " . $featured . "\" title=\"" . $feature['gallery_image_caption'] . "\" ><img border=\"0\" src=\"" . UPLOAD_DIR_URL . getThumbnailFilename($feature['gallery_image_filename'], 'small') . "\" class=\"gallery_img_featured\" /><br><strong>Sort#:</strong>" . $feature['gallery_image_sort_order'] . "</a>";
                echo "</div>\n";
            }
            echo "<div class=\"clear\"></div>\n";
            while ($img = dbFetchArray($imgResults)) {
                if ($img['gallery_image_featured'] == 1) {
                    $featured = " featured";
                } else {
                    $featured = "";
                }
                echo "<div id=\"img_" . $img['gallery_image_id'] . "\" class=\"galeryImg\">";
                echo "<a href=\"editimage.php?gallery=" . $galleryID . "&image_id=" . $img['gallery_image_id'] . "\" class=\"galleryThumb modal " . $featured . "\" title=\"" . $img['gallery_image_caption'] . "\" ><img border=\"0\" src=\"" . UPLOAD_DIR_URL . getThumbnailFilename($img['gallery_image_filename'], 'thumb') . "\" class=\"gallery_img\" /><br><strong>Sort#:</strong>" . $img['gallery_image_sort_order'] . "</a>";
                echo "</div>\n";
            }
            echo "<div class=\"clear\"></div>\n";
            echo "</div>";
        }
    }
}
示例#3
0
文件: store.php 项目: sherdog/cvsi
    echo "<tr>";
    echo "<td class=\"pageTitleSub\">" . $default . " Product Image</td>";
    echo "<td class=\"pageTitleSub\"><input name=\"image[" . $i . "]\" type=\"file\" class=\"textField-title\" id=\"image_" . $i . "\" /></td>";
    echo "</tr>";
}
?>
                                                             <?
															  if($_GET['action'] == 'editproduct') { //check to see if an image already exists if so then we want to allow the user to view the image
															  	$imgCheck = dbQuery('SELECT * FROM store_products_images WHERE products_id = ' . $_GET['id']);
																if(dbNumRows($imgCheck)) {
																	
																	while($imgInfo = dbFetchArray($imgCheck))
																	{
																		echo "<tr>";
																		echo "<td value=\"top\" class=\"pageTitleSub\">Image: <br /><span style=\"font-size:10px; font-weight:normal\">(click to enlarge)</a></td>";
																		echo "<td><a href=\"".STORE_IMAGE_URL . $imgInfo['products_images_filename']."\" target=\"_blank\" class=\"title\"><img src=\"".STORE_IMAGE_URL . getThumbnailFilename($imgInfo['products_images_filename'], 'thumb')."\" /><br /><a href=\"store.php?action=deleteproductimage&id=".$imgInfo['products_images_id']."&pid=".$_GET['id']."\">Delete</a></td>";
																		echo "</tr>";
																	}
																}
															  }
															  ?>
													        <tr>
													          <td class="pageTitleSub">Category</td>
													          <td class="pageTitleSub"><select name="c" id="c" class="textField-title">
													            <?
															  $categories = dbQuery('SELECT * FROM store_categories ORDER BY categories_title');
															  while($cInfo = dbFetchArray($categories)) {
																echo "<option value=\"".$cInfo['categories_id']."\"";
																	if($cInfo['categories_id'] == $_GET['c'])
																		echo " selected";
																echo ">".output($cInfo['categories_title'])."</option>\n";
示例#4
0
<form id="imagePageCaptionForm" method="post" action="savePageCaption.php">
<input type="hidden" name="action" value="save" />
<input type="hidden" name="page_content_id" id="page_content_id" value="<?php 
echo $_GET['page'];
?>
" />
<input type="hidden" name="image_id" id="image_id" value="<?php 
echo $_GET['image_id'];
?>
" />
 
  <table width="100%" border="0" cellspacing="0" cellpadding="5">
   
    <tr>
      <td width="100" rowspan="5" valign="top"><img src="<?php 
echo UPLOAD_DIR_URL . getThumbnailFilename($gal['page_gallery_image_filename'], 'small');
?>
" /></td>
      <td class="pageTitleSub">Image Caption</td>
    </tr>
    <tr>
      <td><textarea name="desc" cols="35" rows="5"  id="desc"><?php 
echo output($gal['page_gallery_image_caption']);
?>
</textarea></td>
    </tr>
    <tr>
      <td class="pageTitleSub">Sort Order</td>
    </tr>
    <tr>
      <td><input name="sort_order" type="text" class="fieldLabel" id="sort_order" value="<?php 
示例#5
0
文件: publish.php 项目: sherdog/cvsi
							echo "<tr>\n";
							echo "<td>\n";
							echo "<img src=\"".getThumbnailFilename(UPLOAD_DIR_URL.$e['calendar_events_image'], 'small')."\">\n";
							echo "</td>\n";
							echo "</tr>\n";
						}
						?>
                       
						 <tr>
					      <td class="pageTitleSub"><span class="fieldLabel">Event Main Image</span><span class="smallText">760px x 80px</span> <input type="file" name="event_main_image" id="event_main_image" /></td>
				        </tr>
                         <?
						if($e['calendar_events_main_image'] != '') {
							echo "<tr>\n";
							echo "<td>\n";
							echo "<img src=\"".getThumbnailFilename(UPLOAD_DIR_URL.$e['calendar_events_main_image'], 'small')."\">\n";
							echo "</td>\n";
							echo "</tr>\n";
						}
						?>
					  </table>
					  
					 
					  
					<div class="mb20"></div></td>
					<td width="250" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="">
					  <tr>
						<td>
						<div style="margin:0px 10px 10px 10px;">
						
						<table width="100%" border="0" cellspacing="0" cellpadding="5" class="actionBox">
示例#6
0
文件: upload.php 项目: sherdog/cvsi
<?php

/* This script is used with swfupload */
/* We are going to be upload and storing the gallery images /*
/* Create thumbnails and return a true statement! */
include 'application.php';
if ($_FILES['Filedata']['name'] != "" && isset($_POST['gallery_id'])) {
    $filename = time() . fixFilename($_FILES['Filedata']['name']);
    uploadFile($_FILES['Filedata'], $filename);
    foreach ($galleryImageSizes as $name => $size) {
        makeThumbnail($filename, UPLOAD_DIR, $size, '', $name);
    }
    $row['gallery_id'] = $_POST['gallery_id'];
    $row['gallery_image_filename'] = $filename;
    $row['gallery_date_added'] = time();
    $row['gallery_image_caption'] = '';
    dbPerform('gallery_images', $row, 'insert');
    $imageID = dbInsertID();
    //get total images then add one for the sort order number!
    $imgResults = dbQuery('SELECT gallery_image_id FROM gallery_images WHERE gallery_id = ' . $_POST['gallery_id']);
    $count = dbNumRows($imgResults);
    $next = $count++;
    $row2['gallery_image_sort_order'] = $next;
    dbPerform('gallery_images', $row2, 'update', 'gallery_image_id = ' . $imageID);
    echo "FILEID:" . UPLOAD_DIR_URL . getThumbnailFilename($filename, 'thumb');
} else {
    return false;
    die;
}