• [Mod] Add thumbnails to admin edit images list 5 0 5 1
Currently:  

Author Topic: [Mod] Add thumbnails to admin edit images list  (Read 27041 times)

0 Members and 1 Guest are viewing this topic.

Offline jengwen

  • Jr. Member
  • **
  • Posts: 85
    • View Profile
    • http://www.jenrichardsphotography.com
[Mod] Add thumbnails to admin edit images list
« on: March 17, 2003, 01:31:59 AM »
This mod will show the thumbnail before the image name in the control panel edit images list used for deleting or editting images.

File to change is admin/images.php

find:
Code: [Select]
$sql = "SELECT i.image_id, i.cat_id, i.user_id, i.image_name, i.image_media_file, i.image_date".get_user_table_field(", u.", "user_name")."
            FROM ".IMAGES_TABLE." i, ".USERS_TABLE." u
            WHERE $condition AND ".get_user_table_field("u.", "user_id")." = i.user_id
            ORDER BY $orderby $direction
            LIMIT $limitstart, $limitnumber";
    $result = $site_db->query($sql);


add after i.image_media_file,:
Code: [Select]
i.image_thumb_file,

find:
Code: [Select]
echo "<td><b><a href=\"".$site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$image_row['image_id'])."\" target=_blank>".htmlspecialchars($image_row['image_name'])."</a></b> (".$image_row['image_media_file'];

add after target=_blank>:
Code: [Select]
<img src=\"".THUMB_PATH."/".$image_row['cat_id']."/".$image_row['image_thumb_file']."\" width=\"40\" height=\"40\" border=\"1\" alt=\"\" />

final code should look like this if you just want to cut and paste the entire section:
Code: [Select]
   $sql = "SELECT i.image_id, i.cat_id, i.user_id, i.image_name, i.image_media_file, i.image_thumb_file, i.image_date".get_user_table_field(", u.", "user_name")."
            FROM ".IMAGES_TABLE." i, ".USERS_TABLE." u
            WHERE $condition AND ".get_user_table_field("u.", "user_id")." = i.user_id
            ORDER BY $orderby $direction
            LIMIT $limitstart, $limitnumber";
    $result = $site_db->query($sql);

    while ($image_row = $site_db->fetch_array($result)) {
      echo "<tr class=\"".get_row_bg()."\">";
      echo "<td><input type=\"checkbox\" name=\"deleteimages[]\" value=\"".$image_row['image_id']."\" /></td>";

      echo "<td><b><a href=\"".$site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$image_row['image_id'])."\" target=_blank><img src=\"".THUMB_PATH."/".$image_row['cat_id']."/".$image_row['image_thumb_file']."\" width=\"40\" height=\"40\" border=\"1\" alt=\"\" />".htmlspecialchars($image_row['image_name'])."</a></b> (".$image_row['image_media_file'];

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Administrator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: [mod] Add thumbnails to admin edit images list
« Reply #1 on: March 17, 2003, 03:08:22 AM »
Exelent! good job!
here is little fix, if an image is some media, or it doesnt have thumbnail, it shows red X
just change this code:
Quote from: jengwen
add after target=_blank>:
Code: [Select]
<img src=\"".THUMB_PATH."/".$image_row['cat_id']."/".$image_row['image_thumb_file']."\" width=\"40\" height=\"40\" border=\"1\" alt=\"\" />


To this:
Code: [Select]
<img src=\"".((empty($image_row['image_thumb_file'])) ? ICON_PATH."/".get_file_extension($image_row['image_media_file']).".gif" : ((is_remote($image_row['image_thumb_file'])) ? $image_row['image_thumb_file'] : ROOT_PATH.THUMB_DIR."/".$image_row['cat_id']."/".$image_row['image_thumb_file']))."\" width=\"40\" height=\"40\" border=\"1\" alt=\"\" />&nbsp;
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 soze

  • Newbie
  • *
  • Posts: 17
    • View Profile
[Mod] Add thumbnails to admin edit images list
« Reply #2 on: March 22, 2003, 12:56:03 AM »
Very usefull MOD!  :D

Offline eXup

  • Newbie
  • *
  • Posts: 14
    • View Profile
    • http://www.KartPoint.com
[Mod] Add thumbnails to admin edit images list
« Reply #3 on: March 22, 2003, 08:18:23 AM »
Great job, thank you...

...can you do "this" to comments.php, too? - I tried it on my own, but i failed because i'm a beginner in php.
eXup
A straight road is only a connection between two curves...

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Administrator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
[Mod] Add thumbnails to admin edit images list
« Reply #4 on: March 22, 2003, 01:13:46 PM »
Quote from: eXup
Great job, thank you...

...can you do "this" to comments.php, too? - I tried it on my own, but i failed because i'm a beginner in php.


Open /admin/comments.php
Find:
Code: [Select]
   $sql = "SELECT c.comment_id, c.image_id, c.user_id, c.user_name, c.comment_headline, c.comment_text, c.comment_date, i.image_name
Replace with:
Code: [Select]
   $sql = "SELECT c.comment_id, c.image_id, c.user_id, c.user_name, c.comment_headline, c.comment_text, c.comment_date, i.image_name, i.image_media_file, i.image_thumb_file, i.cat_id


Find:
Code: [Select]
<td class=\"tableseparator\">".$lang['field_comment']."</td>
Replace with:
Code: [Select]
<td class=\"tableseparator\" colspan=2>".$lang['field_comment']."</td>

Find:
Code: [Select]
     echo "<td><input type=\"checkbox\" name=\"deletecomments[]\" value=\"".$comment_row['comment_id']."\" /></td>";
Add after:
Code: [Select]
     echo "<td><img src=\"".((empty($comment_row['image_thumb_file'])) ? ICON_PATH."/".get_file_extension($comment_row['image_media_file']).".gif" : ((is_remote($comment_row['image_thumb_file'])) ? $comment_row['image_thumb_file'] : ROOT_PATH.THUMB_DIR."/".$comment_row['cat_id']."/".$comment_row['image_thumb_file']))."\" width=\"40\" height=\"40\" border=\"1\" alt=\"\" /></td>";
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 Neo1

  • Full Member
  • ***
  • Posts: 202
    • View Profile
    • http://www.terradreams.de/
[Mod] Add thumbnails to admin edit images list
« Reply #5 on: March 22, 2003, 01:37:02 PM »
Thanks a lot jengwen V@no: Great Mod.

I have to use the second code cause i got remote images. Works godd :)

Offline eXup

  • Newbie
  • *
  • Posts: 14
    • View Profile
    • http://www.KartPoint.com
[Mod] Add thumbnails to admin edit images list
« Reply #6 on: March 23, 2003, 03:43:18 PM »
Thank you very much. Works perfect on comments.php, too.

(Can comprehend what you did and i learn step by step  :idea: )
eXup
A straight road is only a connection between two curves...

Offline Cancy

  • Newbie
  • *
  • Posts: 20
    • View Profile
    • http://www.fantasy-arthouse.de
kategorieauswahl
« Reply #7 on: March 23, 2003, 04:43:25 PM »
Gibt es evtl. die Möglichkeit, die Kategorien dort nicht als Link sondern als Dropdown anzeigen zu lassen, so das man dort die Kategorie auch ändern könnte, in die das Bild nach der Freischaltung kommt?

LG
Cancy

Offline Bodyworks

  • Newbie
  • *
  • Posts: 24
    • View Profile
    • http://www.digitalfotos-online.de
[Mod] Add thumbnails to admin edit images list
« Reply #8 on: April 13, 2003, 05:50:00 AM »
This is a great MOD. Thank you for that great help.
Would it be possible to add the functionality editing keywords, description and picture name after they have been uploaded in that kind of view? The thumbnails are big enough to identify the picture. Editing keywords after upload is a very poor job when you have a slow internet connection.
Perhaps you can think about this idea.

It would rather help to edit my about 2.000 photos.

Thank you in advance and kind regards.
Regards
Bodyworks

Offline Biggi

  • Jr. Member
  • **
  • Posts: 74
    • View Profile
    • http://www.bibodia.de/
[Mod] Add thumbnails to admin edit images list
« Reply #9 on: April 13, 2003, 10:22:53 AM »
Thanks a lot, V@ano! That a great mod!

But there seems to be a very little bug. Please have a look:


What do I have to change to see the WORD in dropdown instead of the php-code? In this way it works, but I'd like to see the "sort images by VOTES, RATINGS" etc.

Thanks in advance!

Kind regards, Biggi

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Administrator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
[Mod] Add thumbnails to admin edit images list
« Reply #10 on: April 13, 2003, 12:37:59 PM »
Quote from: Biggi
Thanks a lot, V@ano! That a great mod!

dont thank me, thank jengwen ;)

Quote from: Biggi
But there seems to be a very little bug.
What do I have to change to see the WORD in dropdown instead of the php-code? In this way it works, but I'd like to see the "sort images by VOTES, RATINGS" etc.

My guess is u did something wrong when installing the mod. check again the changes u made.
also, did u install anything else that do any changes /admin/ files?

[EDITED]
but did it work before modification?
I dont see anything that could cause it, unless the PHP on your host doesnt support on one line:
<?php echo $lang['order_by'] ?>
maybe try to add <?php echo $lang['order_by']; ?> and check the rest simular lines. (I doubt it cause the problem)
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 Biggi

  • Jr. Member
  • **
  • Posts: 74
    • View Profile
    • http://www.bibodia.de/
[Mod] Add thumbnails to admin edit images list
« Reply #11 on: April 13, 2003, 01:02:10 PM »
Ouuuuups - my mistake  :oops:  Special thanks to jengwen  :D

You are right, V@no. There was a mistake made by my editor. I took another one and now it works perfectly  :P

Thx,

Biggi

Offline fossil

  • Pre-Newbie
  • Posts: 5
    • View Profile
[Mod] Add thumbnails to admin edit images list
« Reply #12 on: April 18, 2003, 01:52:37 AM »
I know i have done everything right as jengwen writes. but when im done and go to the ACP and press edit images, nothing wont show. if i reverse what i have done. everything works fine.

Im using 4images v1.7

Offline uksoreeyes

  • Full Member
  • ***
  • Posts: 117
    • View Profile
    • http://www.myleeneklass.com
Re: [mod] Add thumbnails to admin edit images list
« Reply #13 on: April 24, 2003, 02:53:23 AM »
Hi V@no I have spotted a little mistake in the code you supplied:
Code: [Select]
<img src="".((empty($image_row['image_thumb_file'])) ? ICON_PATH."/".get_file_extension($image_row['image_media_file']).".gif" : ((is_remote($image_row['image_thumb_file'])) ? $image_row['image_thumb_file'] : ROOT_PATH.THUMB_DIR."/".$image_row['cat_id']."/".$image_row['image_thumb_file']))."\" width=\"40\" height=\"40\" border=\"1\" alt=\"\" />&nbsp;

You missed out a \ in the <img src="".((empty($im... which I think was down to this forum because I have had trouble getting the forum to display the \. Anyways the missing \ caused me to get this error:
Quote
Parse error: parse error, expecting `','' or `';'' in \htdocs\admin\images.php on line 769

So if anyone else got this error just change the above code to this:
Quote
<img src=\"".((empty($image_row['image_thumb_file'])) ? ICON_PATH."/".get_file_extension($image_row['image_media_file']).".gif" : ((is_remote($image_row['image_thumb_file'])) ? $image_row['image_thumb_file'] : ROOT_PATH.THUMB_DIR."/".$image_row['cat_id']."/".$image_row['image_thumb_file']))."\" width=\"40\" height=\"40\" border=\"1\" alt=\"\" />&nbsp;


I have also made a little mod to the way this mod is layed out, I'll post that here in a bit if anyone is interested. It just gives it a nicer ordered look :)

Offline uksoreeyes

  • Full Member
  • ***
  • Posts: 117
    • View Profile
    • http://www.myleeneklass.com
[Mod] Add thumbnails to admin edit images list
« Reply #14 on: April 24, 2003, 03:14:31 AM »
Ok here is my little mod to give the thumbnails their own column in the table :)

Open admin/images.php

find:
Code: [Select]
echo "<td class=\"tableseparator\">".$lang['field_image_name']."</td>\n<td class=\"tableseparator\">".$lang['field_category']."</td>\n<td class=\"tableseparator\">".$lang['field_username']."</td>\n<td class=\"tableseparator\">".$lang['field_date']."</td>\n<td class=\"tableseparator\">".$lang['options']."</td>\n</tr>\n";
replace with:
Code: [Select]
echo "<td class=\"tableseparator\">Image thumbnail</td>\n";
echo "<td class=\"tableseparator\">".$lang['field_image_name']."</td>\n<td class=\"tableseparator\">".$lang['field_category']."</td>\n<td class=\"tableseparator\">".$lang['field_username']."</td>\n<td class=\"tableseparator\">".$lang['field_date']."</td>\n<td class=\"tableseparator\">".$lang['options']."</td>\n</tr>\n";

assuming you have followed v@nos little update along with mine above, find:
Code: [Select]
echo "<td><b><a href=\"".$site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$image_row['image_id'])."\" target=_blank><img src=\"".((empty($image_row['image_thumb_file'])) ? ICON_PATH."/".get_file_extension($image_row['image_media_file']).".gif" : ((is_remote($image_row['image_thumb_file'])) ? $image_row['image_thumb_file'] : ROOT_PATH.THUMB_DIR."/".$image_row['cat_id']."/".$image_row['image_thumb_file']))."\" width=\"40\" height=\"40\" border=\"1\" alt=\"\" />&nbsp;".htmlspecialchars($image_row['image_name'])."</a></b> (".$image_row['image_media_file'];
replace with:
Code: [Select]
echo "<td align=\"center\"><a href=\"".$site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$image_row['image_id'])."\" target=_blank><img src=\"".((empty($image_row['image_thumb_file'])) ? ICON_PATH."/".get_file_extension($image_row['image_media_file']).".gif" : ((is_remote($image_row['image_thumb_file'])) ? $image_row['image_thumb_file'] : ROOT_PATH.THUMB_DIR."/".$image_row['cat_id']."/".$image_row['image_thumb_file']))."\" border=\"1\" alt=\"\" /></a></td>\n";
echo "<td><b><a href=\"".$site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$image_row['image_id'])."\" target=_blank>".htmlspecialchars($image_row['image_name'])."</a></b> (".$image_row['image_media_file'];

And thats it. Save your file. If you find a fault with this little add on mod feel free to tell me.

Carl