• [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 171872 times)

0 Members and 1 Guest are viewing this topic.

Offline satine88

  • Sr. Member
  • ****
  • Posts: 265
    • View Profile
Re: [Mod] Display image codes on details page (image permalink)
« Reply #15 on: March 11, 2008, 02:31:02 PM »
Thanks :)

Offline ccsakuweb

  • Sr. Member
  • ****
  • Posts: 498
  • Patri
    • View Profile
    • My Art
Re: [Mod] Display image codes on details page (image permalink)
« Reply #16 on: March 21, 2008, 08:36:10 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!

There is a function named: is_remote(_) that it see if the image is remote. Ok you need to do the next
Find into the mod:
Code: [Select]
      $uploaded_image_path = $script_url."/".MEDIA_DIR."/".$cat_id."/".$new_name;
      $uploaded_thumb_path = $script_url."/".THUMB_DIR."/".$cat_id."/".$new_name;
and remplace:
Code: [Select]
if(is_remote($new_name)){
      $uploaded_image_path = $new_name;
}else{
  $uploaded_image_path = $script_url."/".MEDIA_DIR."/".$cat_id."/".$new_name;
}
if(is_remote($image_row['image_thumb_file']))
  $uploaded_thumb_path = $image_row['image_thumb_file'];
else
  $uploaded_thumb_path = $script_url."/".THUMB_DIR."/".$cat_id."/".$new_name;
 
:arrow: 4images Paid Mods: Links, Blog, Albums, Subdomains for users, Diferent templates for user profile, Related picture in details, Last pictures in details.
And the mod that you request me.   Demo: http://www.myart.es

A website dedicated to artist people who loves drawing, design, writing and more

Offline jany.yar

  • Pre-Newbie
  • Posts: 9
    • View Profile
Re: [Mod] Display image codes on details page (image permalink)
« Reply #17 on: March 24, 2008, 12:39:19 AM »
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!

There is a function named: is_remote(_) that it see if the image is remote. Ok you need to do the next
Find into the mod:
Code: [Select]
      $uploaded_image_path = $script_url."/".MEDIA_DIR."/".$cat_id."/".$new_name;
      $uploaded_thumb_path = $script_url."/".THUMB_DIR."/".$cat_id."/".$new_name;
and remplace:
Code: [Select]
if(is_remote($new_name)){
      $uploaded_image_path = $new_name;
}else{
  $uploaded_image_path = $script_url."/".MEDIA_DIR."/".$cat_id."/".$new_name;
}
if(is_remote($image_row['image_thumb_file']))
  $uploaded_thumb_path = $image_row['image_thumb_file'];
else
  $uploaded_thumb_path = $script_url."/".THUMB_DIR."/".$cat_id."/".$new_name;
 


It didn't work for me :( and I am sure I have not made any mistakes.. because I did exactly as you instructed.

Offline bogiayeu

  • Pre-Newbie
  • Posts: 8
    • View Profile
Re: [Mod] Display image codes on details page (image permalink)
« Reply #18 on: March 24, 2008, 01:21:59 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!

There is a function named: is_remote(_) that it see if the image is remote. Ok you need to do the next
Find into the mod:
Code: [Select]
      $uploaded_image_path = $script_url."/".MEDIA_DIR."/".$cat_id."/".$new_name;
      $uploaded_thumb_path = $script_url."/".THUMB_DIR."/".$cat_id."/".$new_name;
and remplace:
Code: [Select]
if(is_remote($new_name)){
      $uploaded_image_path = $new_name;
}else{
  $uploaded_image_path = $script_url."/".MEDIA_DIR."/".$cat_id."/".$new_name;
}
if(is_remote($image_row['image_thumb_file']))
  $uploaded_thumb_path = $image_row['image_thumb_file'];
else
  $uploaded_thumb_path = $script_url."/".THUMB_DIR."/".$cat_id."/".$new_name;
 


Not work ! Can you fix it ?

Offline ccsakuweb

  • Sr. Member
  • ****
  • Posts: 498
  • Patri
    • View Profile
    • My Art
Re: [Mod] Display image codes on details page (image permalink)
« Reply #19 on: March 24, 2008, 03:22:12 PM »
In details.php i have this code. please try it

Code: [Select]

$new_name = $image_row['image_media_file'];

if(is_remote($new_name)){
      $uploaded_image_path = $new_name;
}else{
  $uploaded_image_path = $script_url."/".MEDIA_DIR."/".$cat_id."/".$new_name;
}
if(is_remote($image_row['image_thumb_file']))
  $uploaded_thumb_path = $image_row['image_thumb_file'];
else
  $uploaded_thumb_path = $script_url."/".THUMB_DIR."/".$cat_id."/".$image_row['image_thumb_file'];
   
      $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=\"".$image_row['image_thumb_file']."\"></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 --------------------------
//-----------------------------------------------------
i modified the original mod because i think that the thubnail dont have to have the same name that original file
and i think that it is not necessary the SELECT consult because all that exist in $image_row in detail.php
i hope help you all

:arrow: 4images Paid Mods: Links, Blog, Albums, Subdomains for users, Diferent templates for user profile, Related picture in details, Last pictures in details.
And the mod that you request me.   Demo: http://www.myart.es

A website dedicated to artist people who loves drawing, design, writing and more

Offline DilnüvaZ

  • 4images Moderator
  • Hero Member
  • *****
  • Posts: 527
  • Gönül Okşayıcı
    • View Profile
    • Nuvanda Resimlere Dair Ne Varsa
Re: [Mod] Display image codes on details page (image permalink)
« Reply #20 on: March 29, 2008, 10:17:29 AM »
thanks lots  it is very good.... i did it and it worked.http://www.nuvanda.net/r-cicek-resimleri-50-cicekler-771.htm

Offline cpuswe

  • Newbie
  • *
  • Posts: 47
    • View Profile
Re: [Mod] Display image codes on details page (image permalink)
« Reply #21 on: March 31, 2008, 12:45:37 AM »
Really nice mod!

For us who have added this mod http://www.4homepages.de/forum/index.php?topic=17598.0 to create Googlefriendly URL:s, is it possible to display the page URL as in the mod <a href="http://www.site.net/img-imagename-12345.htm> instead of <a href="http://www.site.net/details.php?image_id=12345">

Thanks!

/Thomas

Offline Percolator

  • Pre-Newbie
  • Posts: 3
    • View Profile
Re: [Mod] Display image codes on details page (image permalink)
« Reply #22 on: March 31, 2008, 06:06:12 AM »
Worked like a charm thank you!

Offline saggel

  • Newbie
  • *
  • Posts: 10
    • View Profile
Re: [Mod] Display image codes on details page (image permalink)
« Reply #23 on: April 19, 2008, 12:44:59 AM »
Great Mod :)

Offline LeaX

  • Newbie
  • *
  • Posts: 12
    • View Profile
    • Lost Jack and Kate
Re: [Mod] Display image codes on details page (image permalink)
« Reply #24 on: May 22, 2008, 01:36:33 PM »
I can't undertand why after all these steps only registered people can see these codes.  8O
And I have only one registrated user  :roll: admin
How can I make it work for everybody?

Offline rockboy_62

  • Newbie
  • *
  • Posts: 12
    • View Profile
Re: [Mod] Display image codes on details page (image permalink)
« Reply #25 on: June 04, 2008, 09:21:48 AM »
.i want use image link(permalink) in the home page(index).please help me

Offline masumcis

  • Newbie
  • *
  • Posts: 13
  • Masum
    • View Profile
    • Photo Gallery
Re: [Mod] Display image codes on details page (image permalink)
« Reply #26 on: June 04, 2008, 12:37:47 PM »
Nice
« Last Edit: June 04, 2008, 12:53:34 PM by masumcis »
<<M@sum>>

Offline HowdoI

  • Newbie
  • *
  • Posts: 12
    • View Profile
Re: [Mod] Display image codes on details page (image permalink)
« Reply #27 on: August 15, 2008, 08:20:29 PM »
I am extremely new to this program and I am still feeling my way around with different mods etc.

I have successfully installed this mod without a problem, but the problem arises when I try to limit the options to just the second last one, the one titles 'Share this image'  I want to get rid of all the other links as this one would allow for posting to other sites but force the person to come to my site to view it which results in a new member (hopefully).  I am taking something out of the code that results in an error in the detail.php file, can some please advise on what I am sure is a newbie error.

Also I just noticed that you can not highlight the link and then right click to copy as a copyright message appears preventing this.  To me this makes the link option nonvalid.  I am playing around with version 1.7.6 which memory serves me correctly this has only been test to 1.7.4 so is there a way around this second problem?

Any help is appriecated and also I just want to say that I have looked at about 20 - 25 websites offering this type of program and this one blow everyone one of them out of the water 3 times over so Kudos to all that support and work on this program.

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: [Mod] Display image codes on details page (image permalink)
« Reply #28 on: August 16, 2008, 12:25:50 AM »
Hello and welcome to 4images forum.

I try to limit the options to just the second last one, the one titles 'Share this image'  I want to get rid of all the other links as this one would allow for posting to other sites but force the person to come to my site to view it which results in a new member (hopefully).  I am taking something out of the code that results in an error in the detail.php file, can some please advise on what I am sure is a newbie error.
Next time please show the exact error message (quote it), it might help and speedup the solution.

All you need is remove this block:
      $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 />";



Also I just noticed that you can not highlight the link and then right click to copy as a copyright message appears preventing this.  To me this makes the link option nonvalid.  I am playing around with version 1.7.6 which memory serves me correctly this has only been test to 1.7.4 so is there a way around this second problem?

You can try this:
in header.html template replace
Code: [Select]
  function right(e) {
    if ((document.layers || (document.getElementById && !document.all)) && (e.which == 2 || e.which == 3)) {
      alert("© Copyright by {site_name}");
      return false;
    }
    else if (event.button == 2 || event.button == 3) {
      alert("© Copyright by {site_name}");
      return false;
    }
    return true;
  }

  if (document.layers){
    document.captureEvents(Event.MOUSEDOWN);
    document.onmousedown = right;
  }
  else if (document.all && !document.getElementById){
    document.onmousedown = right;
  }

document.oncontextmenu = new Function("alert('© Copyright by {site_name}');return false");

With this:
Code: [Select]
  function right(e) {
    if ((document.layers || (document.getElementById && !document.all)) && (e.which == 2 || e.which == 3)) {
      msg(e);
      return false;
    }
    else if (event.button == 2 || event.button == 3) {
      msg(e);
      return false;
    }
    return true;
  }

  function msg(e)
  {
    var target = window.event ? window.event.srcElement : e ? e.target : null;
    if (target.type != "text" && target.type != "textarea" && target.type != "password")
    {
      alert("© Copyright by <?=str_replace("'","\'", "{site_name}");?>");
      return false;
    }
    return true;
  }

  if (document.layers){
    document.captureEvents(Event.MOUSEDOWN);
    document.onmousedown = right;
  }
  else if (document.all && !document.getElementById){
    document.onmousedown = right;
  }

document.oncontextmenu = msg;
This will allow right click on any input fields, text areas and password fields. Tested on FF 3 and IE 6
« Last Edit: February 09, 2009, 07:47:37 AM by V@no »
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 V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: [Mod] Display image codes on details page (image permalink)
« Reply #29 on: August 16, 2008, 01:51:25 AM »
I believe in unnecessary HTML code should NOT be used inside PHP code, simply because it's hard to adopt it to your template.
Here is a replacement for entire Step 3 that also gives support for remote images:

In details.php find:
show_image($image_row$mode01);


Insert above:
Code: [Select]
//-----------------------------------------------------
//--- ImageCodes v1.1 Begins --------------------------
//-----------------------------------------------------

// Mod: ImageCodes v1.1
// Version: 1.1
// Description : Get image path, link and bbcode on the details page
// Contact: arjoon@gmail.com
// Last update: August 15 2008

$site_template->register_vars(array(
  "uploaded_image_path" => str_replace("'", "&#39;", (is_remote($image_row['image_media_file']) ? $image_row['image_media_file'] : $script_url."/".str_replace(ROOT_PATH, "", get_file_path($image_row['image_media_file'], "media", $cat_id, 0, 0)))),
  "uploaded_thumb_path" => str_replace("'", "&#39;", (is_remote($image_row['image_thumb_file']) ? $image_row['image_thumb_file'] : $script_url."/".str_replace(ROOT_PATH, "", get_file_path($image_row['image_thumb_file'], "thumb", $cat_id, 0, 0)))),
  "uploaded_image_link" => $script_url."/details.php?".URL_IMAGE_ID."=".$image_id,
  "uploaded_file_name"  => str_replace("'", "&#39;", $image_row['image_media_file']),
  "homepage"   => $script_url."/index.php"
));
//-----------------------------------------------------
//--- end of ImageCodes v1.1 --------------------------
//-----------------------------------------------------

After that in Step 2 instead of using {image_codes} you'll have more control over your design, you can use these new tags:
{uploaded_image_path} - full image path
{uploaded_thumb_path} - thumbnail image path
{uploaded_image_link} - url to image details page
{uploaded_file_name} - image filename
{homepage} - site homepage url

i.e.
Code: [Select]
<table border="0" width="500px" align="center">
  <tr>
    <td>
      <font size="2" face="Tahoma"><b>Image Codes:</b></font><br />
      <input onfocus='highlight(this);' onclick='highlight(this);' style='border-style:solid; border-width:1; padding:2; width: 300px; background-color:#FFFFFF; color:#000000' size='70' value='<a href="{uploaded_image_link}"><img src="{uploaded_thumb_path}" border="0" alt="{uploaded_file_name}"></a>' type='text' name='image'> Thumbnail for websites<br />
      <input onfocus='highlight(this);' onclick='highlight(this);' style='border-style:solid; border-width:1; padding:2; width: 300px; background-color:#FFFFFF; color:#000000' size='70' value='[URL={uploaded_image_link}][IMG]{uploaded_thumb_path}[/IMG][/URL]' type='text' name='image'> Thumbnail for forums<br /><br />
      <font size='1' face='Tahoma'>Use the below codes to post the full sized image on other websites or forums</font><br />
      <input onfocus='highlight(this);' onclick='highlight(this);' style='border-style:solid; border-width:1; padding:2; width: 300px; background-color:#FFFFFF; color:#000000' size='70' value='<a href="{homepage}"><img src="{uploaded_image_path}" border="0" alt="{uploaded_file_name}"></a>' type='text' name='image'> Hotlink for websites<br />
      <input onfocus='highlight(this);' onclick='highlight(this);' style='border-style:solid; border-width:1; padding:2; width: 300px; background-color:#FFFFFF; color:#000000' size='70' value='[URL={homepage}][IMG]{uploaded_image_path}[/IMG][/URL]' type='text' name='image'> Hotlink for forums<br /><br />
      <font size='1' face='Tahoma'>Share this image with your friends</font><br />
      <input onfocus='highlight(this);' 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 />
      <input onfocus='highlight(this);' 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 />
    </td>
  </tr>
</table>
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)