Hi people,
Currently I'm finishing the setup of a small image bank. We upload the pics with the batch utility, using one folder per each image owner.
As some owners can have more of 5,000 pics, it's tiring to open the batch upload and wait until the page finishes to load, only to search at the bottom for, say 300 new pics.
For that reason I have made the following change to searchnew.php (1.3.3)
Now only shows the new pics and doesn't shows the previously uploaded pics. As I have saw some requests of people for this I decided to publish it here:
Search for function picrow:
function picrow($picfile, $picid, $albid)
{
global $CONFIG, $expic_array;
$encoded_picfile = base64_encode($picfile);
$picname = $CONFIG['fullpath'] . $picfile;
$pic_url = urlencode($picfile);
$pic_fname = basename($picfile);
$pic_dirname = dirname($picname);
$thumb_file = dirname($picname) . '/' . $CONFIG['thumb_pfx'] . $pic_fname;
if (file_exists($thumb_file)) {
$thumb_info = getimagesize($picname);
$thumb_size = compute_img_size($thumb_info[0], $thumb_info[1], 48);
$img = '<img src="' . path2url($thumb_file) . '" ' . $thumb_size['geom'] . ' class="thumbnail" border="0" />';
} elseif (is_image($picname)) {
$img = '<img src="showthumb.php?picfile=' . $pic_url . '&size=48" class="thumbnail" border="0">';
} else {
$file['filepath'] = $pic_dirname.'/'; //substr($picname,0,strrpos($picname,'/'))
$file['filename'] = $pic_fname;
$filepathname = get_pic_url($file,'thumb');
//$mime_content = get_type($picname);
//$extension = file_exists("images/thumb_{$mime_content['extension']}.jpg") ? $mime_content['extension']:$mime_content['content'];
//$img = '<img src="images/thumb_'.$extension.'.jpg" class="thumbnail" width="48" border="0">';
$img = '<img src="'.$filepathname.'" class="thumbnail" width="48" border="0">';
}
if (filesize($picname) && is_readable($picname)) {
//$fullimagesize = getimagesize($picname); COMMENTED OUT FOR VIDEO SUPPORT
$winsizeX = ($fullimagesize[0] + 16);
$winsizeY = ($fullimagesize[1] + 16);
//$checked = isset($expic_array[$picfile]) || !$fullimagesize ? '' : 'checked';
$checked = isset($expic_array[$picfile]) ? '' : 'checked';
return <<<EOT
<tr>
<td class="tableb" valign="middle">
<input name="pics[]" id="picselector" type="checkbox" value="$picid" $checked />
<input name="album_lb_id_$picid" type="hidden" value="$albid" />
<input name="picfile_$picid" type="hidden" value="$encoded_picfile" />
</td>
<td class="tableb" valign="middle" width="100%">
<a href="javascript:;" onClick= "MM_openBrWindow('displayimage.php?&fullsize=1&picfile=$pic_url', 'ImageViewer', 'toolbar=yes, status=yes, resizable=yes, width=$winsizeX, height=$winsizeY')">$pic_fname</a>
</td>
<td class="tableb" valign="middle" align="center">
<a href="javascript:;" onClick= "MM_openBrWindow('displayimage.php?&fullsize=1&picfile=$pic_url', 'ImageViewer', 'toolbar=yes, status=yes, resizable=yes, width=$winsizeX, height=$winsizeY')"><img src="images/spacer.gif" width="1" height="48" alt="" border="0" />$img<br /></a>
</td>
</tr>
EOT;
} else {
$winsizeX = (300);
$winsizeY = (300);
return <<<EOT
Now replace with:
function picrow($picfile, $picid, $albid)
{
global $CONFIG, $expic_array;
$encoded_picfile = base64_encode($picfile);
$picname = $CONFIG['fullpath'] . $picfile;
$pic_url = urlencode($picfile);
$pic_fname = basename($picfile);
$pic_dirname = dirname($picname);
$thumb_file = dirname($picname) . '/' . $CONFIG['thumb_pfx'] . $pic_fname;
if (file_exists($thumb_file)) {
$thumb_info = getimagesize($picname);
$thumb_size = compute_img_size($thumb_info[0], $thumb_info[1], 48);
$img = '<img src="' . path2url($thumb_file) . '" ' . $thumb_size['geom'] . ' class="thumbnail" border="0" />';
} elseif (is_image($picname)) {
$img = '<img src="showthumb.php?picfile=' . $pic_url . '&size=48" class="thumbnail" border="0">';
} else {
$file['filepath'] = $pic_dirname.'/'; //substr($picname,0,strrpos($picname,'/'))
$file['filename'] = $pic_fname;
$filepathname = get_pic_url($file,'thumb');
//$mime_content = get_type($picname);
//$extension = file_exists("images/thumb_{$mime_content['extension']}.jpg") ? $mime_content['extension']:$mime_content['content'];
//$img = '<img src="images/thumb_'.$extension.'.jpg" class="thumbnail" width="48" border="0">';
$img = '<img src="'.$filepathname.'" class="thumbnail" width="48" border="0">';
}
if (filesize($picname) && is_readable($picname)) {
//$fullimagesize = getimagesize($picname); COMMENTED OUT FOR VIDEO SUPPORT
$winsizeX = ($fullimagesize[0] + 16);
$winsizeY = ($fullimagesize[1] + 16);
//$checked = isset($expic_array[$picfile]) || !$fullimagesize ? '' : 'checked';
$checked = isset($expic_array[$picfile]) ? '' : 'checked';
if ($checked == 'checked'){
return <<<EOT
<tr>
<td class="tableb" valign="middle">
<input name="pics[]" id="picselector" type="checkbox" value="$picid" $checked />
<input name="album_lb_id_$picid" type="hidden" value="$albid" />
<input name="picfile_$picid" type="hidden" value="$encoded_picfile" />
</td>
<td class="tableb" valign="middle" width="100%">
<a href="javascript:;" onClick= "MM_openBrWindow('displayimage.php?&fullsize=1&picfile=$pic_url', 'ImageViewer', 'toolbar=yes, status=yes, resizable=yes, width=$winsizeX, height=$winsizeY')">$pic_fname</a>
</td>
<td class="tableb" valign="middle" align="center">
<a href="javascript:;" onClick= "MM_openBrWindow('displayimage.php?&fullsize=1&picfile=$pic_url', 'ImageViewer', 'toolbar=yes, status=yes, resizable=yes, width=$winsizeX, height=$winsizeY')"><img src="images/spacer.gif" width="1" height="48" alt="" border="0" />$img<br /></a>
</td>
</tr>
EOT;
}
} else {
$winsizeX = (300);
$winsizeY = (300);
return <<<EOT
It uses the checked variable to decide if a picture has been uploaded (it must has a thumbnail)
I hope that it can be useful for some of you.
Regards,
Klingsor