4images Modifications / Modifikationen > Mods & Plugins (Releases & Support)

[Mod] Display image codes on details page (image permalink)

(1/21) > >>

MaveriC:
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: ---<script type="text/javascript">

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

Step 2:

Open templates/your template name/details.html

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


--- Code: ---{image_codes}
--- End code ---

Step 3:

Open details.php

Find

--- Code: ---$site_template->print_template($site_template->parse_template($main_template));
--- End code ---

Above it, paste:

--- Code: ---
//-----------------------------------------------------
//--- 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 --------------------------
//-----------------------------------------------------

--- End code ---

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 :)

BartAfterDark:
nice :) Are you playning on updating it so it uses a template file instead of having the HTML in details.php? :)

AZzUrRI:
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


skidpics:
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>

skidpics:
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!

Navigation

[0] Message Index

[#] Next page

Go to full version