• [Mod] Display image codes on details page (image permalink) 5 0 5 1
Currently:  

Author Topic: [Mod] Display image codes on details page (image permalink)  (Read 143364 times)

0 Members and 1 Guest are viewing this topic.

Offline MaveriC

  • Newbie
  • *
  • Posts: 32
    • View Profile
Name: ImageCodes v1.0
Works on 1.7.4
Last updated: June 30 2007
Description:
Use this mod to add the image path, image link and BBCode as in UploadInfo v1.0 on your details page.

Check the UploadInfo mod here where you can display this code immediately after image upload:
http://www.4homepages.de/forum/index.php?topic=17911.0

To brief the mod again:
This mod will display the below image codes which we find on most image hosting services and picture galleries these days on the details page.

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

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

Step 1: (only for people who have not installed the UploadInfo mod)

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 templates/your template name/details.html

Add the below code where you want the image codes to appear.

Code: [Select]
{image_codes}
Step 3:

Open details.php

Find
Code: [Select]
$site_template->print_template($site_template->parse_template($main_template));
Above it, paste:
Code: [Select]

//-----------------------------------------------------
//--- ImageCodes v1.0 Begins --------------------------
//-----------------------------------------------------

// Mod: ImageCodes v1.0
// Version: 1.0
// Description : Get image path, link and bbcode on the details page
// Contact: arjoon@gmail.com
// Last update: June 30 2007

$sql = "SELECT image_media_file FROM ".IMAGES_TABLE." WHERE image_id= $image_id";
$image_codes = $site_db->query_firstrow($sql);

$new_name = $image_codes['image_media_file'];

      $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=".$script_url."][IMG]".$uploaded_image_path."[/IMG][/URL]";
      $uploaded_thumb_bbcode = "[URL=".$uploaded_image_link."][IMG]".$uploaded_thumb_path."[/IMG][/URL]";
      $uploadinfo .= "<font size='2' face='Tahoma'><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>";
      $icodes .= "<table border=\"0\" width=\"500px\" align=\"center\">\n<tr>\n<td>\n".$uploadinfo."\n</td>\n</tr>\n</table>\n";

      $site_template->register_vars("image_codes", $icodes);

//-----------------------------------------------------
//--- end of ImageCodes v1.0 --------------------------
//-----------------------------------------------------

That's it! you'r done! :D

I guess am done for this weekend too :p any bugs, changes and suggestions are welcome as usual :)
« Last Edit: August 16, 2008, 12:36:08 AM by V@no »

Offline BartAfterDark

  • Hero Member
  • *****
  • Posts: 520
    • View Profile
Re: [Mod] Display image codes on details page (image permalink)
« Reply #1 on: July 23, 2007, 05:07:24 PM »
nice :) Are you playning on updating it so it uses a template file instead of having the HTML in details.php? :)

Offline AZzUrRI

  • Pre-Newbie
  • Posts: 1
    • View Profile
Re: [Mod] Display image codes on details page (image permalink)
« Reply #2 on: October 05, 2007, 05:30:04 PM »
Thaaaaaaaaaanx Alot For this mod .. i was looking for it .. but there is a question ..
how can i add sentence with link back to my site like this (( click to get cool comments ))
under the pic that the user will paste on forum or other site  ..
Note::  under the pic not beside it ...

I try to do it .. but i put this sentence with link beside the pic .. i wasn't able to put this link under the pic ...

Thanx for help ...   8O



Offline skidpics

  • Jr. Member
  • **
  • Posts: 61
    • View Profile
Re: [Mod] Display image codes on details page (image permalink)
« Reply #3 on: October 11, 2007, 02:07:03 AM »
I have been trying to tweak it so it shows within the link code:  Browse and Host your images as skidpics.com

I have been trying to tweak it, but cannot get the coding right..



</a><br><a href="http://skidpics.com" class="style1">Browse or host your pictures on skidpics.com </a></p>

I would figure we add it after the initial hotlink code..  or even can create a new variable to be included in the linking?

Here is a non working sample added to one of the variables:
$uploaded_thumb_hotlink = "<a href=\"".$uploaded_image_link."\"><img src=\"".$uploaded_thumb_path."\" border=\"0\" alt=\"".$new_name."\"></a>";</a><br><a href="http://skidpics.com" class="style1">Browse or host your pictures on skidpics.com </a></p>

So, in the end, it would appear for an image code like this:
<a href="http://skidpics.com/albums/Outdoor/Sunset/normal_plages.jpg"><img src="http://skidpics.com/albums/Outdoor/Sunset/thumb_plages.jpg" alt="No Title" /></a><br><a href="http://skidpics.com" class="style1">Browse or host your pictures on skidpics.com </a></p>

« Last Edit: October 17, 2007, 11:46:59 PM by skidpics »

Offline skidpics

  • Jr. Member
  • **
  • Posts: 61
    • View Profile
Re: [Mod] Display image codes on details page (image permalink)
« Reply #4 on: October 17, 2007, 11:46:39 PM »
What do I need to add so that when you click in the text field of the code, it will either highlight all of it automatically, or better yet, highlight and copy it to the clipboard all at once?

Thanks for the great mod!

Offline KurtW

  • 4images Guru
  • *******
  • Posts: 2.778
    • View Profile
    • Malediven-Bilder ~~Dreams~~
Re: [Mod] Display image codes on details page (image permalink)
« Reply #5 on: October 18, 2007, 06:08:42 AM »
Quote
Here is a non working sample added to one of the variables:
$uploaded_thumb_hotlink = "<a href=\"".$uploaded_image_link."\"><img src=\"".$uploaded_thumb_path."\" border=\"0\" alt=\"".$new_name."\"></a>";</a><br><a href="http://skidpics.com" class="style1">Browse or host your pictures on skidpics.com </a></p>

And here is a working sample:

Code: [Select]
$uploaded_thumb_hotlink = "<a href=\"".$uploaded_image_link."\"><img src=\"".$uploaded_thumb_path."\" border=\"0\" alt=\"".$new_name."\"></a><br /><a href=\"http://skidpics.com\" class=\"style1\">Browse or host your pictures on skidpics.com </a>";

Kurt

Offline skidpics

  • Jr. Member
  • **
  • Posts: 61
    • View Profile
Re: [Mod] Display image codes on details page (image permalink)
« Reply #6 on: October 18, 2007, 03:24:17 PM »
Thanks Kurt for getting the right coding set up for me! 

Offline J.Lond

  • Newbie
  • *
  • Posts: 23
    • View Profile
Re: [Mod] Display image codes on details page (image permalink)
« Reply #7 on: November 28, 2007, 10:17:47 AM »
First off let may say this is a great mod and thanks for putting it together.  Now my problem.  It works great when the images are pictures ie jpg, gif, and so on.  The problem occurs when you deal with other formats.  The thumb hot link takes the extension of the image format.  Thumb link for movie sample.flv will be sample.flv instead of sample.jpg. The thumb path is correct but the thumb file name is incorrect.  Wrong extension.  The following is a sample of how the image code shows up for "thumbnail for websites".

<a href="http://www.yoursite.com/details.php?image_id=6470"><img src="http://www.yoursite.com/data/thumbnails/141/sample.flv" border="0" alt="sample.flv"></a>


Thanks

Offline J.Lond

  • Newbie
  • *
  • Posts: 23
    • View Profile
Re: [Mod] Display image codes on details page (image permalink)
« Reply #8 on: December 10, 2007, 08:51:09 AM »
I am bumping this thread to see if anyone has a solution for my problem asked earlier.

Thanks

skiemor

  • Guest
Re: [Mod] Display image codes on details page (image permalink)
« Reply #9 on: December 29, 2007, 07:41:06 PM »
Hi @ all,
I want to place only a link "Image-Codes" and show the codes in
a "details_info.html". How to make that.

If I allow to see details for guests, the codes are usable for guest.
That I don't like. How can I get permission only for pic_owner or member?

Chris.

Offline thunderstrike

  • 4images Guru
  • *******
  • Posts: 2.327
    • View Profile
Re: [Mod] Display image codes on details page (image permalink)
« Reply #10 on: December 29, 2007, 08:16:33 PM »
In details.php file,

find:

Code: [Select]
// Last update: June 30 2007

add after:

Code: [Select]
if ($user_info['user_level'] >= USER) {

find:

Code: [Select]
$site_template->register_vars("image_codes", $icodes);

add after:

Code: [Select]
}

In templates/your_template/header.html file,

find:

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

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

replace:

Code: [Select]
{if user_loggedin}<script type="text/javascript">

function highlight(field) {
        field.focus();
        field.select();
}
</script>
{endif user_loggedin}
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 ?

skiemor

  • Guest
Re: [Mod] Display image codes on details page (image permalink)
« Reply #11 on: December 29, 2007, 08:45:37 PM »
Great!  :D

Quote
I want to place only a link "Image-Codes" and show the codes in
a "details_info.html". How to make that.

How to make that? With permission only for members.

Chris.

Offline FotoRalle

  • Jr. Member
  • **
  • Posts: 57
  • 4images als bestes Community-Script
    • View Profile
    • rs webregie | webdesign & webmaster
Re: [Mod] Display image codes on details page (image permalink)
« Reply #12 on: January 10, 2008, 12:51:06 AM »
Thank you very much for this. It works perfect!

Offline Bengie

  • Pre-Newbie
  • Posts: 1
    • View Profile
Re: [Mod] Display image codes on details page (image permalink)
« Reply #13 on: January 23, 2008, 06:33:27 PM »
Can this be made to work with images hosted off site?
I get something like this:

Code: [Select]
<a href="http://mysite.com"><img src="http://mysite.com/data/media/3/http://i140.photobucket.com/albums/r32/image.gif" border="0" alt="http://i140.photobucket.com/albums/r32/image.gif"></a>
Notice the "img src" tag, the path is wrong...

Thanks!

Offline maineyak

  • Newbie
  • *
  • Posts: 30
    • View Profile
Re: [Mod] Display image codes on details page (image permalink)
« Reply #14 on: March 03, 2008, 09:10:28 PM »
Anyone know how the codes could be added to the image templates themselves? Like jpg.html, gif.html, etc.... I tried to add it to the templates, but it's not working.

 

Post your comments here