4images Forum & Community
Welcome, Guest. Please login or register.
Did you miss your activation email?
May 28, 2018, 11:50:55 AM

Login with username, password and session length
Search:     Advanced search
Togle to toolbar
Translate this page with =>
Translate this page >
* Home Help Search Login Register
 
+  4images Forum & Community
|-+  4images Modifications / Modifikationen
| |-+  Mods & Plugins (Releases & Support) (Moderators: mawenzi, Rembrandt)
| | |-+  [Mod] Display image codes on details page (image permalink)
0 Members and 1 Guest are viewing this topic. « previous next »
Pages: [1] 2 3 4 5 ... 7 » »» Print
Current Topic Rating: *****
Author Topic: [Mod] Display image codes on details page (image permalink)  (Read 117522 times)
MaveriC
Newbie
*
Offline Offline

Posts: 32

Thank You
-Given: 0
-Receive: 2


View Profile
« on: June 30, 2007, 09:06:08 PM »

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

1
2
3
4
5
6
7
<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.

1
{image_codes}

Step 3:

Open details.php

Find
1
$site_template->print_template($site_template->parse_template($main_template));

Above it, paste:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39

//-----------------------------------------------------
//--- 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! Very Happy

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

Posts: 520

Thank You
-Given: 0
-Receive: 2


View Profile
« Reply #1 on: July 23, 2007, 05:07:24 PM »

nice Smile Are you playning on updating it so it uses a template file instead of having the HTML in details.php? Smile
Logged
AZzUrRI
Pre-Newbie

Offline Offline

Posts: 1

Thank You
-Given: 0
-Receive: 0


View Profile
« 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 ...   Shocked


Logged
skidpics
Jr. Member
**
Offline Offline

Posts: 61

Thank You
-Given: 0
-Receive: 0


View Profile
« 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 » Logged
skidpics
Jr. Member
**
Offline Offline

Posts: 61

Thank You
-Given: 0
-Receive: 0


View Profile
« 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!
Logged
KurtW
4images Guru
*******
Offline Offline

Posts: 2778

Thank You
-Given: 0
-Receive: 8


View Profile WWW
« Reply #5 on: October 18, 2007, 06:08:42 AM »

Quote  [Expand]
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:

1
$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
Logged

skidpics
Jr. Member
**
Offline Offline

Posts: 61

Thank You
-Given: 0
-Receive: 0


View Profile
« Reply #6 on: October 18, 2007, 03:24:17 PM »

Thanks Kurt for getting the right coding set up for me! 
Logged
J.Lond
Newbie
*
Offline Offline

Posts: 23

Thank You
-Given: 0
-Receive: 0


View Profile
« 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
Logged
J.Lond
Newbie
*
Offline Offline

Posts: 23

Thank You
-Given: 0
-Receive: 0


View Profile
« 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
Logged
skiemor
Guest
« 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.
Logged
thunderstrike
4images Guru
*******
Offline Offline

Posts: 2327

Thank You
-Given: 0
-Receive: 10


View Profile
« Reply #10 on: December 29, 2007, 08:16:33 PM »

In details.php file,

find:

1
// Last update: June 30 2007

add after:

1
if ($user_info['user_level'] >= USER) {

find:

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

add after:


In templates/your_template/header.html file,

find:

1
2
3
4
5
6
7
<script type="text/javascript">

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

replace:

1
2
3
4
5
6
7
8
{if user_loggedin}<script type="text/javascript">

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

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
« Reply #11 on: December 29, 2007, 08:45:37 PM »

Great!  Very Happy

Quote  [Expand]
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.
Logged
FotoRalle
Jr. Member
**
Offline Offline

Posts: 57

Thank You
-Given: 4
-Receive: 0

4images als bestes Community-Script


View Profile WWW
« Reply #12 on: January 10, 2008, 12:51:06 AM »

Thank you very much for this. It works perfect!
Logged
Bengie
Pre-Newbie

Offline Offline

Posts: 1

Thank You
-Given: 0
-Receive: 0


View Profile
« 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:

1
<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!
Logged
maineyak
Newbie
*
Offline Offline

Posts: 30

Thank You
-Given: 0
-Receive: 0


View Profile
« 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.
Logged
Pages: [1] 2 3 4 5 ... 7 » »» Print 
« previous next »
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF | SMF © 2015, Simple Machines Valid XHTML 1.0! Valid CSS!
Page created in 0.174 seconds with 19 queries.
Post your comments here