• Mod: Display image path, link and BBCode after image upload 4 0 5 1
Currently:  

Author Topic: Mod: Display image path, link and BBCode after image upload  (Read 75350 times)

0 Members and 1 Guest are viewing this topic.

Offline MaveriC

  • Newbie
  • *
  • Posts: 32
    • View Profile
Name: UploadInfo v1.0
Works on 1.7.4
Last updated: June 30 2007
Requirements: GD or any other image editor to create thumbnails on the fly

How this works:

Whenever a user uploads an image, 4images by default does not include any details apart from the image. This mod will display the below codes on the successful upload page just like any free image hosting service.

Apart from the code, the mod will display a thumbnail link to the image rather than the complete image.

Image Codes:
1. Hot link for websites
2. Hot link for forums
3. Thumbnail code for websites
4. Thumbnail code for forums
5. Image link
6. Image path

You can customize the mod to display the complete image and remove any of the above options. This mod should work with other mods and different 4images versions without any issues.

Here's the procedure:

Please take a backup of all the files before modifying the code

Step 1:

Open templates/your template name/header.html

Add the below code anywhere inside the <head> tag

Code: [Select]
<script type="text/javascript">

function highlight(field) {
        field.focus();
        field.select();
}
</script>

Step 2:

Open member.php

Find 
Code: [Select]
$content .= "<table border=\"0\" align=\"center\">\n<tr>\n<td>\n".$media."\n</td>\n</tr>\n</table>\n";
Replace with:
Code: [Select]
//-----------------------------------------------------
//--- UploadInfo v1.0 Begins --------------------------
//-----------------------------------------------------

// Mod: UploadInfo v1.0
// Version: 1.0
// Description : Display image path, link and bbcode after image upload
// Contact: arjoon@gmail.com
// Last update: June 30 2007

      $cat_name = $cat_cache[$cat_id]['cat_name'];
      $uploaded_image_path = $script_url."/".MEDIA_DIR."/".$cat_id."/".$new_name;
      $uploaded_thumb_path = $script_url."/".THUMB_DIR."/".$cat_id."/".$new_name;
      $uploaded_image_link = $script_url."/details.php?image_id=".$image_id;
      $uploaded_thumb_hotlink = "<a href=\"".$uploaded_image_link."\"><img src=\"".$uploaded_thumb_path."\" border=\"0\" alt=\"".$new_name."\"></a>";
      $uploaded_image_hotlink = "<a href=\"".$script_url."\"><img src=\"".$uploaded_image_path."\" border=\"0\" alt=\"".$new_name."\"></a>";
      $uploaded_image_bbcode = "[URL=http://".$script_url."][IMG]http://".$uploaded_image_path."[/img][/URL]";
      $uploaded_thumb_bbcode = "[URL=http://".$uploaded_image_link."][IMG]http://".$uploaded_thumb_path."[/img][/URL]";
      $uploadinfo .= "<center><font size='1' face='Tahoma'>click on the above thumbnail for the full sized image</font><br /><br />";
      $uploadinfo .= "<font size='2' face='Tahoma'><a href='".$script_url."/member.php?action=uploadform&cat_id=".$cat_id."'><b>Upload another image</b></a> or goto <a href='".$script_url."/categories.php?cat_id=".$cat_id."'><b>".$cat_name."'s gallery</b></a></center><br />";
      $uploadinfo .= "<hr color='#C0C0C0' width='80%' size='1'>";
      $uploadinfo .= "<br />";
      $uploadinfo .= "<b>Image Codes:</b><br />";
      $uploadinfo .= "<input onclick='highlight(this);' style='border-style:solid; border-width:1; padding:2; width: 300px; background-color:#FFFFFF; color:#000000' size='70' value='".$uploaded_thumb_hotlink."' type='text' name='image'> Thumbnail for websites<br />";
      $uploadinfo .= "<input onclick='highlight(this);' style='border-style:solid; border-width:1; padding:2; width: 300px; background-color:#FFFFFF; color:#000000' size='70' value='".$uploaded_thumb_bbcode."' type='text' name='image'> Thumbnail for forums<br /><br />";
      $uploadinfo .= "<font size='1' face='Tahoma'>Use the below codes to post the full sized image on other websites or forums</font><br />";
      $uploadinfo .= "<input onclick='highlight(this);' style='border-style:solid; border-width:1; padding:2; width: 300px; background-color:#FFFFFF; color:#000000' size='70' value='".$uploaded_image_hotlink."' type='text' name='image'> Hotlink for websites<br />";
      $uploadinfo .= "<input onclick='highlight(this);' style='border-style:solid; border-width:1; padding:2; width: 300px; background-color:#FFFFFF; color:#000000' size='70' value='".$uploaded_image_bbcode."' type='text' name='image'> Hotlink for forums<br /><br />";
      $uploadinfo .= "<font size='1' face='Tahoma'>Share this image with your friends</font><br />";
      $uploadinfo .= "<input onclick='highlight(this);' style='border-style:solid; border-width:1; padding:2; width: 300px; background-color:#FFFFFF; color:#000000' size='70' value='".$uploaded_image_link."' type='text' name='image'> Share this image<br />";
      $uploadinfo .= "<input onclick='highlight(this);' style='border-style:solid; border-width:1; padding:2; width: 300px; background-color:#FFFFFF; color:#000000' size='70' value='".$uploaded_image_path."' type='text' name='image'> Direct path to image<br /><br /></font>";
      // remove the below line if your site doesnt require image validation
      $uploadinfo .= "<center><font size='1' face='Tahoma'>[ This image may require validation before it actually appears on the gallery ]</font></center>";
      $content .= "<table border=\"0\" align=\"center\">\n<tr>\n<td>\n<a href='".$uploaded_image_link."'>".$media."</a>\n</td>\n</tr>\n</table>\n";
      $content .= "<table border=\"0\" width=\"500px\" align=\"center\">\n<tr>\n<td>\n".$uploadinfo."\n</td>\n</tr>\n</table>\n";

//-----------------------------------------------------
//--- end of UploadInfo v1.0 --------------------------
//-----------------------------------------------------

That's it! :D

If you want to use the same image codes on the details page as well, click below
http://www.4homepages.de/forum/index.php?topic=17912.0

If there are any bugs/changes/suggestions, do let me know.
« Last Edit: October 16, 2007, 03:44:41 PM by KurtW »

Offline kai

  • Administrator
  • Addicted member
  • *****
  • Posts: 1.421
    • View Profile
    • 4images - Image Gallery Management System
Re: Mod: Display image path, link and BBCode after image upload
« Reply #1 on: October 12, 2007, 06:40:10 PM »
Good mod!
Your first three "must do" before you ask a question:
1. Forum rules
2. FAQ
3. Search

Offline Mr_LovaLove

  • Full Member
  • ***
  • Posts: 233
  • Unkown
    • View Profile
Re: Mod: Display image path, link and BBCode after image upload
« Reply #2 on: October 12, 2007, 11:39:38 PM »
Good Mod

Nice job :o)

but if the user upload an image the option (hotlinks) appears to him/her only ONCE

if he want to see them back  later ? how can he get the (hotlinks) information

i like the way and the place of the links :P

hope u have a way
English Please :@

Offline Loda

  • Sr. Member
  • ****
  • Posts: 353
    • View Profile
    • Fotosucht Schweiz
Re: Mod: Display image path, link and BBCode after image upload
« Reply #3 on: October 13, 2007, 09:41:10 AM »
morning mr lovalove!
open your eyes!  :)
Quote
If you want to use the same image codes on the details page as well, click below
http://www.4homepages.de/forum/index.php?topic=17912.0

Offline Mr_LovaLove

  • Full Member
  • ***
  • Posts: 233
  • Unkown
    • View Profile
Re: Mod: Display image path, link and BBCode after image upload
« Reply #4 on: October 13, 2007, 06:31:25 PM »
@Loda :P

yeah i know this  :P

but i was asking if its possible to save it only for the owner of the image :P so only he/she can see this details kind of privacy :-0

tell ya the truth i didnt try that code !1 but if only the owner of the image can see the hotlinks :P then that what im lookin for  ^_*

and thanks for ur try :)
English Please :@

Offline thunderstrike

  • 4images Guru
  • *******
  • Posts: 2.327
    • View Profile
Re: Mod: Display image path, link and BBCode after image upload
« Reply #5 on: October 13, 2007, 06:59:57 PM »
I no use this MOD and is look good too but please

find:

Quote
$cat_name = $cat_cache[$cat_id]['cat_name'];

replace:

Code: [Select]
$cat_name = format_text(trim($cat_cache[$cat_id]['cat_name']), 2);

@Loda :P

yeah i know this  :P

but i was asking if its possible to save it only for the owner of the image :P so only he/she can see this details kind of privacy :-0

tell ya the truth i didnt try that code !1 but if only the owner of the image can see the hotlinks :P then that what im lookin for  ^_*

and thanks for ur try :)

For this, I no test but you need to find:

Quote
// Last update: June 30 2007

add after:

Code: [Select]
if ($check_image_owner = $site_db->query_firstrow("SELECT user_id FROM " . IMAGES_TABLE . " WHERE image_id = " . $image_id . " AND cat_id = " . $cat_id . " AND user_id = " . $user_info['user_id']) || $check_image_owner = $site_db->query_firstrow("SELECT user_id FROM " . IMAGES_TEMP_TABLE . " WHERE image_id = " . $image_id . " AND cat_id = " . $cat_id . " AND user_id = " . $user_info['user_id'])) {
   if (isset($check_image_owner) && !empty($check_image_owner) && $user_info['user_level'] > USER_AWAITING && $user_info['user_info['user_id'] == $check_image_owner['user_id']) {

Find:

Quote
$content .= "<table border=\"0\" width=\"500px\" align=\"center\">\n<tr>\n<td>\n".$uploadinfo."\n</td>\n</tr>\n</table>\n";

add after:

Code: [Select]
   }
}
8 steps need when ask question -

- PHP version (ACP - > phpinfo())
- mySQL version (ACP - > phpinfo())
- 4images version
- Post screenshot / URL
- Post code in BB Code (no need full file for code) or post attach file
- It doesn't work. What is say - what is do for no work
- Install MOD ? If so - please say (troubleshooting)
- Read FAQ ? Install Bug fixes ?

Offline Mr_LovaLove

  • Full Member
  • ***
  • Posts: 233
  • Unkown
    • View Profile
Re: Mod: Display image path, link and BBCode after image upload
« Reply #6 on: October 13, 2007, 08:08:12 PM »
@thunder

thanks for ur try but not work !

i will try to add the hotlink at details.html  better than at upload coz it might be lost if the user didnot save the info :)
English Please :@

Offline thunderstrike

  • 4images Guru
  • *******
  • Posts: 2.327
    • View Profile
Re: Mod: Display image path, link and BBCode after image upload
« Reply #7 on: October 13, 2007, 08:48:52 PM »
Quote
i will try to add the hotlink at details.html  better than at upload coz it might be lost if the user didnot save the info

This is right and easy with details.html. ;)

In the file, look for: if ($is_image_owner) { condition and add code there.
8 steps need when ask question -

- PHP version (ACP - > phpinfo())
- mySQL version (ACP - > phpinfo())
- 4images version
- Post screenshot / URL
- Post code in BB Code (no need full file for code) or post attach file
- It doesn't work. What is say - what is do for no work
- Install MOD ? If so - please say (troubleshooting)
- Read FAQ ? Install Bug fixes ?

Offline Mr_LovaLove

  • Full Member
  • ***
  • Posts: 233
  • Unkown
    • View Profile
Re: Mod: Display image path, link and BBCode after image upload
« Reply #8 on: October 13, 2007, 10:11:18 PM »
thanks for this :D

tried works with little modifications :P

thnks thunder :D
English Please :@

Offline thunderstrike

  • 4images Guru
  • *******
  • Posts: 2.327
    • View Profile
Re: Mod: Display image path, link and BBCode after image upload
« Reply #9 on: October 13, 2007, 10:21:51 PM »
I correct your code. No need for recall SQL for this. Use same object is ok.

Note: Please use good text editor, I see:

Quote
ȤԎ ȡࠦϠɇ∓ޡ ⛑֠ȡ֦҉ ȡ䖛҉ ۡ졇⤦Ȟڠ爡䥊

in your line and this cause MOD no work correct and is reason for fail with my MODs you install. Other, is very good. ;)
8 steps need when ask question -

- PHP version (ACP - > phpinfo())
- mySQL version (ACP - > phpinfo())
- 4images version
- Post screenshot / URL
- Post code in BB Code (no need full file for code) or post attach file
- It doesn't work. What is say - what is do for no work
- Install MOD ? If so - please say (troubleshooting)
- Read FAQ ? Install Bug fixes ?

Offline Mr_LovaLove

  • Full Member
  • ***
  • Posts: 233
  • Unkown
    • View Profile
Re: Mod: Display image path, link and BBCode after image upload
« Reply #10 on: October 21, 2007, 09:48:05 PM »
@thunder

was ur last comment for me O_o

English Please :@

Offline thunderstrike

  • 4images Guru
  • *******
  • Posts: 2.327
    • View Profile
Re: Mod: Display image path, link and BBCode after image upload
« Reply #11 on: October 21, 2007, 09:50:56 PM »
... yes ...
8 steps need when ask question -

- PHP version (ACP - > phpinfo())
- mySQL version (ACP - > phpinfo())
- 4images version
- Post screenshot / URL
- Post code in BB Code (no need full file for code) or post attach file
- It doesn't work. What is say - what is do for no work
- Install MOD ? If so - please say (troubleshooting)
- Read FAQ ? Install Bug fixes ?

Offline fasteddie

  • Pre-Newbie
  • Posts: 3
    • View Profile
Re: Mod: Display image path, link and BBCode after image upload
« Reply #12 on: November 06, 2007, 12:43:12 AM »
This isnt working for me. I amgetting this error

Code: [Select]
Parse error: syntax error, unexpected T_STRING in /home/kustom/public_html/ed/member.php on line 64
Thanks
Ed

Offline thunderstrike

  • 4images Guru
  • *******
  • Posts: 2.327
    • View Profile
Re: Mod: Display image path, link and BBCode after image upload
« Reply #13 on: November 06, 2007, 01:24:09 AM »
Quote
Parse error: syntax error, unexpected T_STRING in /home/kustom/public_html/ed/member.php on line 64

Please post from line 60 to line 70 of member.php file.
8 steps need when ask question -

- PHP version (ACP - > phpinfo())
- mySQL version (ACP - > phpinfo())
- 4images version
- Post screenshot / URL
- Post code in BB Code (no need full file for code) or post attach file
- It doesn't work. What is say - what is do for no work
- Install MOD ? If so - please say (troubleshooting)
- Read FAQ ? Install Bug fixes ?

Offline fasteddie

  • Pre-Newbie
  • Posts: 3
    • View Profile
Re: Mod: Display image path, link and BBCode after image upload
« Reply #14 on: November 06, 2007, 01:41:42 AM »
Lines 60-70
v1.7.4


Code: [Select]
    show_error_page($lang['no_permission']);
    exit;
  }

  $txt_clickstream = get_category_path($comment_row['cat_id'], 1).$config['category_separator']."<a href=%22%22.$site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$comment_row['image_id'])."\" class=\"clickstream\">".format_text($comment_row['image_name'], 2)."</a>".$config['category_separator'];
  $txt_clickstream .= $lang['comment_delete'];

  $sql = "UPDATE ".IMAGES_TABLE."
          SET image_comments = image_comments - 1
          WHERE image_id = ".$comment_row['image_id'];
  $site_db->query($sql);