Tweak MOD: Admin CP Validate Images SectionSupported versions: 1.7.X
Supported browsers: IE5+, FF1+, Opera 7+
Publisher/Copyright: 2XG Media (ggrec.com / CodeLifter.com)
Credits: drJeckyll, treZ
What was wrong:Well, this MOD is more for big sites, where your users upload 100+ images daily. It's a mess to validate those images fast, since there was no good enough default sorting, preview was too small, no rotation function for the images, and if you wanted to check an image in it's original size it opens in a new window. Maybe the biggest problem was that 4images was loading the original images instead of the thumbnails, what slows down the validation enormous.
What does this MOD- instead of loading the original images, validation is loading now just the thumbnails what makes it 10 times faster
- instead of opening the image on click in a new window, now a popup with the image opens when you move the mouse over the thumbnail. It fits automatically to the image size, showing the image and the image name. It changes when you move over an other thumbnail, so you'll have only one popup opened.
INSTALLSTEP ONEopen your /admin/
admin_functions.phpand search for:
<script type="text/javascript" language="javascript" src="<?php echo ROOT_PATH; ?>admin/browserSniffer.js"></script>
<script type="text/javascript" language="javascript" src="<?php echo ROOT_PATH; ?>admin/calendar.js"></script>
insert
ABOVE<script>
// SETUP:
// ===============================
// Set the horizontal and vertical position for the popup
PositionX = 10;
PositionY = 10;
// Set these value approximately 20 pixels greater than the
// size of the largest image to be used (needed for Netscape)
defaultWidth = 500;
defaultHeight = 500;
// Set autoclose true to have the window close automatically
// Set autoclose false to allow multiple popup windows
var AutoClose = true;
// Do not edit below this line...
// ================================
if (parseInt(navigator.appVersion.charAt(0))>=4){
var isNN=(navigator.appName=="Netscape")?1:0;
var isIE=(navigator.appName.indexOf("Microsoft")!=-1)?1:0;}
var optNN='scrollbars=no,width='+defaultWidth+',height='+defaultHeight+',left='+PositionX+',top='+PositionY;
var optIE='scrollbars=no,width=150,height=100,left='+PositionX+',top='+PositionY;
function popImage(imageURL,imageTitle){
if (isNN){imgWin=window.open('about:blank','',optNN);}
if (isIE){imgWin=window.open('about:blank','',optIE);}
with (imgWin.document){
writeln('<html><head><title>Loading...</title><style>body{margin:0px;}</style>');writeln('<sc'+'ript>');
writeln('var isNN,isIE;');writeln('if (parseInt(navigator.appVersion.charAt(0))>=4){');
writeln('isNN=(navigator.appName=="Netscape")?1:0;');writeln('isIE=(navigator.appName.indexOf("Microsoft")!=-1)?1:0;}');
writeln('function reSizeToImage(){');writeln('if (isIE){');writeln('window.resizeTo(100,100);');
writeln('width=100-(document.body.clientWidth-document.images[0].width);');
writeln('height=100-(document.body.clientHeight-document.images[0].height);');
writeln('window.resizeTo(width,height);}');writeln('if (isNN){');
writeln('window.innerWidth=document.images["George"].width;');writeln('window.innerHeight=document.images["George"].height;}}');
writeln('function doTitle(){document.title="'+imageTitle+'";}');writeln('</sc'+'ript>');
if (!AutoClose) writeln('</head><body bgcolor=000000 scroll="no" onload="reSizeToImage();doTitle();self.focus()">')
else writeln('</head><body bgcolor=000000 scroll="no" onload="reSizeToImage();doTitle();self.focus()" onblur="self.close()">');
writeln('<img name="George" src='+imageURL+' style="display:block"></body></html>');
close();
}}
</script>
Edit the settings if needed after that save and close your
admin_functions.phpSTEP TWOopen your /admin/
validateimages.phpand search for:
echo "<td><a href=\"".$image_path."\" target=\"_blank\"><img src=\"".$file_src."\" border=\"1\" height=\"50\"></a></td>";
echo "<td><b><a href=\"".$image_path."\" target=\"_blank\">".format_text($image_row['image_name'], 2)."</a></b> (".$image_row['image_media_file'];
replace it with:
echo "<td><a href=\"javascript:popImage('".$file_src."','".htmlspecialchars($image_row['image_name'])."')\" onMouseOver=\"javascript:popImage('".$file_src."','".htmlspecialchars($image_row['image_name'])."')\">";
echo "<img src=\"";
echo "../data/tmp_thumbnails/".basename($file_src);
echo "\" border=\"1\" height=\"50\"></a><br></td>";
echo "<td><b><a href=\"".$image_path."\" target=\"_blank\">".htmlspecialchars($image_row['image_name'])."</a></b> (".$image_row['image_media_file'];
search for:
$orderby = "i.image_date";
and
replace it with:
$orderby = "i.user_id";
save & close your
validateimages.phpTHATS IT Go to your admin panel and try the validate images section, everything should be all right.