Advanced search  

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Pages: 1 [2]   Go Down

Author Topic: Image description popups and Firefox...  (Read 30511 times)

0 Members and 1 Guest are viewing this topic.

Rodinou

  • Contributor
  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 346
  • Tournicoti, Tournicota
    • http://www.sortons.net
Re: Image description popups and Firefox...
« Reply #20 on: August 04, 2005, 10:57:31 pm »

the problem is not here gaugau !

The problem is 50ko for only replace ALT ... it's abused. That's all.

Other scripts do the SAME thing but there do only 5 ko ! With the 45ko ... you can do other things ... that's all.

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: Image description popups and Firefox...
« Reply #21 on: August 05, 2005, 05:56:00 am »

I agree that there are other scripts that can do the same, however with having overlib on your page, you can do loads of other things with it. Why don't you post the alternatives (i.e. let's see some actual code from you instead of lame nagging)?
Logged

Rodinou

  • Contributor
  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 346
  • Tournicoti, Tournicota
    • http://www.sortons.net
Re: Image description popups and Firefox...
« Reply #22 on: August 05, 2005, 12:54:44 pm »

I have begun to work on it ... the script I use is ... 3,3 ko ... for the same thing

I have put this on functions.inc.php but I have a parsed error ... and the line said is 1845 ... so the end of the script : not very practice to find the error :)

Code: [Select]

//////////////////////////////////////////////// CHANGE DHTML POPUP /////////////////////////////////////////////////

                       
                        $pic_title = get_pic_popup($row);
                       

                        $pic_url =  get_pic_url($row, 'thumb');
                        if (!is_image($row['filename'])) {
                                $image_info = getimagesize($pic_url);
                                $row['pwidth'] = $image_info[0];
                                $row['pheight'] = $image_info[1];
                        }

                        $image_size = compute_img_size($row['pwidth'], $row['pheight'], $CONFIG['thumb_width']);

                        $p=$i - 1 + $lower_limit;
                        $p=($p < 0 ? 0 : $p);
                        $thumb_list[$i]['pos'] = $key < 0 ? $key : $p;
                        $thumb_list[$i]['image'] = "<img ".' onMouseover="ddrivetip(\''.$pic_title.'\');" onmouseout="hideddrivetip()"'." src=\"" . $pic_url . "\" class=\"image\" {$image_size['geom']} border=\"0\" alt=\"\" title=\"\"/>";
                        $thumb_list[$i]['caption'] = $row['caption_text'];
                        $thumb_list[$i]['admin_menu'] = '';

//////////////////////////////////////////////// CHANGE DHTML POPUP /////////////////////////////////////////////////                       
   

Code: [Select]
//////////////////////////////////////////////// CHANGE DHTML POPUP /////////////////////////////////////////////////

                          // Return the popup info for a picture
                          function get_pic_popup(&$pic_row)
                          {
                            global $album_date_fmt, $lang_display_thumbnails, $lang_byte_units;
                         
                            if ( $pic_row['title'] == '' ) {
                              $title = $lang_display_thumbnails['filename'].$pic_row['filename']."<br />";
                            } else {
                              $title = $lang_display_thumbnails['title'].$pic_row['title']."<br />";
                            }
                            if ( $pic_row['hits'] ) {
                              $hits = $lang_display_thumbnails['hits'].$pic_row['hits']."<br />";
                            }
                            if ( $pic_row['pic_rating'] ) {
                              $pic_rating = $lang_display_thumbnails['pic_rating'].round($pic_row['pic_rating']/2000)."<br />";
                            }
                            if ( $pic_row['votes'] ) {
                              $votes = $lang_display_thumbnails['votes'].$pic_row['votes']."<br />";
                            }
                            $popup_text=$title.$hits.$pic_rating.$votes.
                                        $lang_display_thumbnails['filesize'].($pic_row['filesize'] >> 10).$lang_byte_units[1]."<br />".
                                        $lang_display_thumbnails['dimensions'].$pic_row['pwidth']."x".$pic_row['pheight']."<br />".
                                        $lang_display_thumbnails['date_added'].localised_date($pic_row['ctime'], $album_date_fmt);
                         
                            return $popup_text;
                          }
                         
//////////////////////////////////////////////// CHANGE DHTML POPUP //////////////////////////////////////////////////


« Last Edit: August 05, 2005, 01:36:18 pm by Rodinou »
Logged

RatKing

  • Contributor
  • Coppermine regular visitor
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 85
    • Personal website
Re: Image description popups and Firefox...
« Reply #23 on: August 06, 2005, 12:31:33 pm »

 ;D GauGau calm down man if people want to whinch about this stuff its fine by me  ;)

I exchanged some pm's with Rodinou and see here the code that will make him happy.

Ok, it's just a short bit of code and I am not going to write the fully detailed description of how to do it as I have limited time today and it is the same as above....

The new code (this is the new function part that goes into the functions.inc.php file):

Code: [Select]
// Return the popup info for a picture
function get_pic_popup(&$pic_row)
{
  global $album_date_fmt, $lang_display_thumbnails, $lang_byte_units;

  if ( $pic_row['title'] == '' ) {
    $title = $lang_display_thumbnails['filename'].$pic_row['filename']."<br />";
  } else {
    $title = $lang_display_thumbnails['title'].$pic_row['title']."<br />";
  }
  if ( $pic_row['hits'] ) {
    $hits = $lang_display_thumbnails['hits'].$pic_row['hits']."<br />";
  }
  if ( $pic_row['pic_rating'] ) {
    $pic_rating = $lang_display_thumbnails['pic_rating'].$pic_row['pic_rating']."<br />";
  }
  if ( $pic_row['votes'] ) {
    $votes = $lang_display_thumbnails['votes'].$pic_row['votes']."<br />";
  }
  $popup_text="<dl>" .
              "<dt>" . $title.$hits.$pic_rating.$votes."</dt>".
              "<dt>" . $lang_display_thumbnails['filesize'].($pic_row['filesize'] >> 10).$lang_byte_units[1]."</dt>".
              "<dt>" . $lang_display_thumbnails['dimensions'].$pic_row['pwidth']."x".$pic_row['pheight']."</dt>".
              "<dt>" . $lang_display_thumbnails['date_added'].localised_date($pic_row['ctime'], $album_date_fmt)."</dt></dl>";
  return $popup_text;
}

Insert in the template file that you are using the following code:
Code: [Select]
<script type="text/javascript">

/***********************************************
* Cool DHTML tooltip script II- © Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
***********************************************/

var offsetfromcursorX=12 //Customize x offset of tooltip
var offsetfromcursorY=10 //Customize y offset of tooltip

var offsetdivfrompointerX=10 //Customize x offset of tooltip DIV relative to pointer image
var offsetdivfrompointerY=14 //Customize y offset of tooltip DIV relative to pointer image. Tip: Set it to (height_of_pointer_image-1).

document.write('<div id="dhtmltooltip"></div>') //write out tooltip DIV
document.write('<img id="dhtmlpointer" src="arrow2.gif">') //write out pointer image

var ie=document.all
var ns6=document.getElementById && !document.all
var enabletip=false
if (ie||ns6)
var tipobj=document.all? document.all["dhtmltooltip"] : document.getElementById? document.getElementById("dhtmltooltip") : ""

var pointerobj=document.all? document.all["dhtmlpointer"] : document.getElementById? document.getElementById("dhtmlpointer") : ""

function ietruebody(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

function ddrivetip(thetext, thewidth, thecolor){
if (ns6||ie){
if (typeof thewidth!="undefined") tipobj.style.width=thewidth+"px"
if (typeof thecolor!="undefined" && thecolor!="") tipobj.style.backgroundColor=thecolor
tipobj.innerHTML=thetext
enabletip=true
return false
}
}

function positiontip(e){
if (enabletip){
var nondefaultpos=false
var curX=(ns6)?e.pageX : event.clientX+ietruebody().scrollLeft;
var curY=(ns6)?e.pageY : event.clientY+ietruebody().scrollTop;
//Find out how close the mouse is to the corner of the window
var winwidth=ie&&!window.opera? ietruebody().clientWidth : window.innerWidth-20
var winheight=ie&&!window.opera? ietruebody().clientHeight : window.innerHeight-20

var rightedge=ie&&!window.opera? winwidth-event.clientX-offsetfromcursorX : winwidth-e.clientX-offsetfromcursorX
var bottomedge=ie&&!window.opera? winheight-event.clientY-offsetfromcursorY : winheight-e.clientY-offsetfromcursorY

var leftedge=(offsetfromcursorX<0)? offsetfromcursorX*(-1) : -1000

//if the horizontal distance isn't enough to accomodate the width of the context menu
if (rightedge<tipobj.offsetWidth){
//move the horizontal position of the menu to the left by it's width
tipobj.style.left=curX-tipobj.offsetWidth+"px"
nondefaultpos=true
}
else if (curX<leftedge)
tipobj.style.left="5px"
else{
//position the horizontal position of the menu where the mouse is positioned
tipobj.style.left=curX+offsetfromcursorX-offsetdivfrompointerX+"px"
pointerobj.style.left=curX+offsetfromcursorX+"px"
}

//same concept with the vertical position
if (bottomedge<tipobj.offsetHeight){
tipobj.style.top=curY-tipobj.offsetHeight-offsetfromcursorY+"px"
nondefaultpos=true
}
else{
tipobj.style.top=curY+offsetfromcursorY+offsetdivfrompointerY+"px"
pointerobj.style.top=curY+offsetfromcursorY+"px"
}
tipobj.style.visibility="visible"
if (!nondefaultpos)
pointerobj.style.visibility="visible"
else
pointerobj.style.visibility="hidden"
}
}

function hideddrivetip(){
if (ns6||ie){
enabletip=false
tipobj.style.visibility="hidden"
pointerobj.style.visibility="hidden"
tipobj.style.left="-1000px"
tipobj.style.backgroundColor=''
tipobj.style.width=''
}
}

document.onmousemove=positiontip

</script>

Of course a simple:
Code: [Select]
<script type="text/javascript" src="tooltip.js"></script> would look better but that is upto you.

Drop the following picture in the images directory: http://www.dynamicdrive.com/dynamicindex5/arrow2.gif
Logged

Rodinou

  • Contributor
  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 346
  • Tournicoti, Tournicota
    • http://www.sortons.net
Re: Image description popups and Firefox...
« Reply #24 on: August 06, 2005, 12:38:16 pm »

I test it as now :)

But warning

Code: [Select]
  $popup_text="<dl>" .
              "<dt>" . $title.$hits.$pic_rating.$votes."</dt>".
              "<dt>" . $lang_display_thumbnails['filesize'].($pic_row['filesize'] >> 10).$lang_byte_units[1]."</dt>".
              "<dt>" . $lang_display_thumbnails['dimensions'].$pic_row['pwidth']."x".$pic_row['pheight']."</dt>".
              "<dt>" . $lang_display_thumbnails['date_added'].localised_date($pic_row['ctime'], $album_date_fmt)."</dt></dl>";
  return $popup_text;
}

The "Good" Code would be

Code: [Select]
  $popup_text="<dl>" .
              "<dd>" . $title.$hits.$pic_rating.$votes."</dt>".
              "<dd>" . $lang_display_thumbnails['filesize'].($pic_row['filesize'] >> 10).$lang_byte_units[1]."</dd>".
              "<dd>" . $lang_display_thumbnails['dimensions'].$pic_row['pwidth']."x".$pic_row['pheight']."</dd>".
              "<dd>" . $lang_display_thumbnails['date_added'].localised_date($pic_row['ctime'], $album_date_fmt)."</dd></dl>";
  return $popup_text;
}

<dt></dt> is used for example, if you want to put a title (or the filename) as title of your popup.

However, I have a parsed error ... the "TOP" (even if I have understood, today, you have no time) to put "in a "SAME POST" all the updated code : it prevents from having errors :). At least, you have forgotten the CSS code :)

MillieJOBarreto

  • Coppermine newbie
  • Offline Offline
  • Gender: Female
  • Posts: 3
    • DearJoaquin.com
Re: Image description popups and Firefox...
« Reply #25 on: September 30, 2005, 01:33:54 am »

I'd like to know how to GET RID of the image description popups (on any browser).

I am unable to post a new topic here, so this topic seemed a little more appropriated than the others...
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: Image description popups and Firefox...
« Reply #26 on: September 30, 2005, 08:25:26 am »

this board is for actual mods, not for support or mod requests, that's why you can't start new threads here. Go to the support board and re-post your question there. Reading the sub-board description and the sticky thread would have told you so as well.
Logged
Pages: 1 [2]   Go Up
 

Page created in 0.022 seconds with 21 queries.