Author Topic: [Mod] Admin CP / Validate Images (Speed/Popup)  (Read 14710 times)

0 Members and 1 Guest are viewing this topic.

Offline trez

  • Hero Member
  • *****
  • Posts: 613
    • View Profile
    • blog / photography
[Mod] Admin CP / Validate Images (Speed/Popup)
« on: February 04, 2007, 03:47:41 PM »
Tweak MOD: Admin CP Validate Images Section

Supported 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.


INSTALL

STEP ONE
open your /admin/admin_functions.php
and search for:

Code: [Select]
   <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
Code: [Select]
<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.php


STEP TWO
open your /admin/validateimages.php
and search for:
Code: [Select]
     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:
Code: [Select]
     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:
Code: [Select]
   $orderby = "i.image_date";
and replace it with:

Code: [Select]
   $orderby = "i.user_id";
save & close your validateimages.php

THATS IT :)
Go to your admin panel and try the validate images section, everything should be all right.
« Last Edit: July 25, 2011, 02:37:06 PM by Rembrandt »

Offline trez

  • Hero Member
  • *****
  • Posts: 613
    • View Profile
    • blog / photography
Re: Tweak MOD: Admin CP / Validate Images (Speed/Popup)
« Reply #1 on: February 04, 2007, 03:52:31 PM »
PS: Rotate images function will be added as an extension to this tweak tomorrow

Jacob

  • Guest
Re: Tweak MOD: Admin CP / Validate Images (Speed/Popup)
« Reply #2 on: July 27, 2007, 11:18:57 AM »
PS: Rotate images function will be added as an extension to this tweak tomorrow
Any update on this  :roll:

Offline crs

  • Jr. Member
  • **
  • Posts: 76
    • View Profile
Re: Tweak MOD: Admin CP / Validate Images (Speed/Popup)
« Reply #3 on: September 23, 2009, 05:10:14 AM »
1.) Is there any way to show the full category path in the validateimages.php?
In validateimages.php i´m only able to see the name of the last category.

example: a user has uploaded a picture into the following category: A/B/C. In validateimages is only displayed the subcategory C but not the other categorys before  :?


2.) Is there any way to get the Description and also the Keywords of the image in validateimages.php displayed?


Thanks for help.

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: Tweak MOD: Admin CP / Validate Images (Speed/Popup)
« Reply #4 on: September 23, 2009, 08:35:52 AM »
1) in validation.php find:
      echo "<td><a href=\"".$site_sess->url(ROOT_PATH."categories.php?".URL_CAT_ID."=".$image_row['cat_id'])."\" target=\"_blank\">".format_text($cat_cache[$image_row['cat_id']]['cat_name'], 2)."</a></td>\n";

Replace it with:
      echo "<td>".get_category_path($image_row['cat_id'], 1)."</td>\n";
« Last Edit: September 24, 2009, 03:15:12 AM by V@no »
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline crs

  • Jr. Member
  • **
  • Posts: 76
    • View Profile
Re: Tweak MOD: Admin CP / Validate Images (Speed/Popup)
« Reply #5 on: September 23, 2009, 06:59:59 PM »
Hello V@no, thanks for your fast answer :)

I´ve installed your modification but ther is now one problem: the last category, where the image is in, is now shon twice.

example: Audi / Tuner / Tuner the correct path would be: Audi / Tuner
example: Maserati / Quattroporte / IV / IV the correct path would be: Maserati / Quattroporte / IV

thanks for help ;)

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: Tweak MOD: Admin CP / Validate Images (Speed/Popup)
« Reply #6 on: September 24, 2009, 03:16:26 AM »
You are right, I've updated the code above.

P.S. with this method clicking on category will open in current window.
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline senloel

  • Full Member
  • ***
  • Posts: 196
    • View Profile
Re: [Mod] Admin CP / Validate Images (Speed/Popup)
« Reply #7 on: September 20, 2013, 09:36:11 PM »
Könnte evtl. jemand diesen MOD einbauen?

Bei mir klappts grad net, aber vllt. liegts an mir ;)