Advanced search  

News:

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

Pages: 1 2 [3] 4 5 6 7 8   Go Down

Author Topic: Flikr style image annotations  (Read 145694 times)

0 Members and 1 Guest are viewing this topic.

Pascal YAP

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: fr
  • Offline Offline
  • Gender: Male
  • Posts: 13833
  • Hello World :-)
    • CPG 1.5.x ExperiMental website
Re: Flikr style image annotations
« Reply #40 on: April 25, 2008, 10:09:56 am »

Quote
Merci beaucoup, Thank you very much.
De Nada  ;D

Vous pouvez aussi répondre ici où moi-même je vous ai répondu :
http://forum.coppermine-gallery.net/index.php/topic,52180.0.html

PYAP said : "De nada. You can also make your answer in our French Topic, where i'd posted something for you".
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15369
Re: Flikr style image annotations
« Reply #41 on: May 13, 2008, 10:14:41 am »

if you want to remove annotations when removing a picture, you have to change the function "delete_picture()" from delete.php

find:
Code: [Select]
    $query = "DELETE FROM {$CONFIG['TABLE_EXIF']} WHERE filename='".addslashes($dir.$file)."' LIMIT 1";
    $result = cpg_db_query($query);

add below:
Code: [Select]
        $query = "DELETE FROM {$CONFIG['TABLE_PREFIX']}notes WHERE pid='$pid'";
    $result = cpg_db_query($query);


-
muu
Logged

platta

  • Coppermine newbie
  • Offline Offline
  • Posts: 7
    • FKK Suedtirol
Re: Flikr style image annotations
« Reply #42 on: May 30, 2008, 10:43:38 pm »

Hello,

I have 2 problems with my gallery. I hope someone can help me please

1. I cannot move the annotation box to the right side
2. It's possible to move the annotate button to the pic menu at the bottom

My gallery is www.feirafotos.com

Thanx in advance

Platta
« Last Edit: May 30, 2008, 11:02:36 pm by platta »
Logged

Rockas

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Gender: Male
  • Posts: 54
  • **Spaceman**
    • Windows and Souls
Re: Flikr style image annotations
« Reply #43 on: May 30, 2008, 10:59:09 pm »

ok... stupid question but... how is it supposed to work?
i installed it... got a button in the pic view page... i click it... nothing happens.
Sorry i don't know and never visited flickr :-(
Logged
My opinions may change but not the fact that I am right!

platta

  • Coppermine newbie
  • Offline Offline
  • Posts: 7
    • FKK Suedtirol
Re: Flikr style image annotations
« Reply #44 on: May 30, 2008, 11:05:23 pm »

Have you activated javascript?
Logged

Rockas

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Gender: Male
  • Posts: 54
  • **Spaceman**
    • Windows and Souls
Re: Flikr style image annotations
« Reply #45 on: May 30, 2008, 11:07:43 pm »

actvate javascript?
what do you mean?
there are no install instructions i just uploaded and installed it

thank you for your reply
Logged
My opinions may change but not the fact that I am right!

platta

  • Coppermine newbie
  • Offline Offline
  • Posts: 7
    • FKK Suedtirol
Re: Flikr style image annotations
« Reply #46 on: May 30, 2008, 11:29:16 pm »

The script uses javascript, so you must be sure that javascript is activated in your browser
Logged

Rockas

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Gender: Male
  • Posts: 54
  • **Spaceman**
    • Windows and Souls
Re: Flikr style image annotations
« Reply #47 on: May 30, 2008, 11:44:32 pm »

Yes i have... i usually use Firefox... just noticed that in IE7 the button doesn't even appear  :(
Logged
My opinions may change but not the fact that I am right!

platta

  • Coppermine newbie
  • Offline Offline
  • Posts: 7
    • FKK Suedtirol
Re: Flikr style image annotations
« Reply #48 on: May 30, 2008, 11:45:37 pm »

can you post the link to your gallery?
Logged

Rockas

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Gender: Male
  • Posts: 54
  • **Spaceman**
    • Windows and Souls
Re: Flikr style image annotations
« Reply #49 on: May 30, 2008, 11:47:16 pm »

sure: http://www.rockas.info/photograph/index.php

thank you for your help
Logged
My opinions may change but not the fact that I am right!

platta

  • Coppermine newbie
  • Offline Offline
  • Posts: 7
    • FKK Suedtirol
Re: Flikr style image annotations
« Reply #50 on: May 30, 2008, 11:56:09 pm »

Logged

Rockas

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Gender: Male
  • Posts: 54
  • **Spaceman**
    • Windows and Souls
Re: Flikr style image annotations
« Reply #51 on: May 31, 2008, 12:09:51 am »

Just re-uploaded all using ftp and fixed for firefox.

IE7 gave me some more problems... had to add my site to "secure" sites?!?!?

thank you for your help
Logged
My opinions may change but not the fact that I am right!

platta

  • Coppermine newbie
  • Offline Offline
  • Posts: 7
    • FKK Suedtirol
Re: Flikr style image annotations
« Reply #52 on: June 11, 2008, 04:17:45 pm »

Hello,

I have  problems with IE6. The note box is moved to the right. I think it's a CSS problem. Does anyone know the solution?

Regards

platta
Logged

stefaanvandamme

  • Coppermine newbie
  • Offline Offline
  • Posts: 1
Re: Flikr style image annotations
« Reply #53 on: July 20, 2008, 09:03:49 pm »

ok... stupid question but... how is it supposed to work?
i installed it... got a button in the pic view page... i click it... nothing happens.
Sorry i don't know and never visited flickr :-(

i had the same problem, but i noticed the folder 'lib' was uploaded during install, so i installed the folder with an ftp program and now everything works perfect
Logged

Gephri

  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Posts: 235
Re: Flikr style image annotations
« Reply #54 on: July 22, 2008, 09:00:35 pm »

Here's a way to move the annotation button into the area that has the admin buttons (below picture).

open:
annotate/codebase.php

Find
      $html =& $CURRENT_PIC_DATA['html'];

Add
      $html1 =& $CURRENT_PIC_DATA['menu'];


Find
      $html .= <<< EOT
      
      <div align="center" style="clear: both; padding-top: 20px">

Change to
      $html1 .= <<< EOT
      
      <div align="center" style="clear: both; padding-top: 20px">



Logged

Gephri

  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Posts: 235
Re: Flikr style image annotations
« Reply #55 on: July 22, 2008, 09:36:55 pm »

Can anyone tell how to add the dirty word filter from the language file ($lang_bad_words) to this plug-in?

Logged

LnQ

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 38
Re: Flikr style image annotations
« Reply #56 on: July 25, 2008, 01:30:42 pm »

absolutely grand!
Is there a way to give permissions to use annotate feature only to some user group? I have made a few tests on my gallery and noticed every registered user can annotate any pic, but I would rather prefere giving this privilege only to some groups.

PS. ah, forgot to mention: Thanks!!!

Hi do anyone know how to mod it so guest can make a annontions?
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15369
Re: Flikr style image annotations
« Reply #57 on: July 25, 2008, 01:37:09 pm »

Hi do anyone know how to mod it so guest can make a annontions?

Open 'codebase.php' and comment out
Code: [Select]
if (USER_ID)and
Code: [Select]
if (!$admin && note.user_id != $user_id) note.editable = false;
This should work.
« Last Edit: July 25, 2008, 01:43:17 pm by eenemeenemuu »
Logged

LnQ

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 38
Re: Flikr style image annotations
« Reply #58 on: July 25, 2008, 02:43:09 pm »

Open 'codebase.php' and comment out
Code: [Select]
if (USER_ID)and
Code: [Select]
if (!$admin && note.user_id != $user_id) note.editable = false;
This should work.

Line 97 /*   if (!$admin && note.user_id != $user_id) note.editable = false; */
and
Line 56 to 66
/*
      if (USER_ID){
         
      $html .= <<< EOT
      
      <div style="clear: both; padding-top: 20px">
         <form action="" method="post">
            <input type="submit" class="button" name="addname" value="Annotate" onclick="return addnote()" />
         </form>
      </div>
*/   

or how...

thanks for the fast reply
Logged

LnQ

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 38
Re: Flikr style image annotations
« Reply #59 on: July 25, 2008, 02:49:31 pm »

don't think it worked as it should

here is what i out commented

Code: [Select]
<?php
/*************************
  Coppermine Photo Gallery
  ************************
  Copyright (c) 2003-2007 Coppermine Dev Team
  v1.1 originally written by Gregory DEMAR

  This program is free software; you can redistribute it and/or modify
  it under the terms of the GNU General Public License as published by
  the Free Software Foundation; either version 2 of the License, or
  (at your option) any later version.
**********************************************/

if (!defined('IN_COPPERMINE')) die('Not in Coppermine...');

if (
defined('DISPLAYIMAGE_PHP')) {
$thisplugin->add_filter('page_meta','annotate_meta');
$thisplugin->add_filter('file_data','annotate_file_data');
}

$thisplugin->add_action('plugin_install','annotate_install');
$thisplugin->add_action('plugin_uninstall','annotate_uninstall');
$thisplugin->add_action('plugin_cleanup','annotate_cleanup');

function 
annotate_meta(){

$meta  "\n" '<script src="plugins/annotate/lib/httpreq.js" type="text/javascript"></script>';
$meta .= "\n" '<script src="plugins/annotate/lib/photonotes.js" type="text/javascript"></script>';
$meta .= "\n" '<link rel="stylesheet" href="plugins/annotate/lib/photonotes.css" type="text/css" />';
$meta .= "\n";

return $meta;
}

function 
annotate_file_data($CURRENT_PIC_DATA){

global $CONFIG;

if (is_image($CURRENT_PIC_DATA['filename'])){

$sql "SELECT * FROM {$CONFIG['TABLE_PREFIX']}notes WHERE pid = {$CURRENT_PIC_DATA['pid']}";
$result cpg_db_query($sql);

$notes = array();

while ($row mysql_fetch_assoc($result)) $notes[] = $row;

mysql_free_result($result);

$jsarray arrayToJS4($notes'annotations');

$html =& $CURRENT_PIC_DATA['html'];

$html '<div class="Photo fn-container" id="PhotoContainer">' $html '</div>';
/*
if (USER_ID){

$html .= <<< EOT

<div style="clear: both; padding-top: 20px">
<form action="" method="post">
<input type="submit" class="button" name="addname" value="Annotate" onclick="return addnote()" />
</form>
</div>

EOT;

}
*/

$user_id  USER_ID;
$admin GALLERY_ADMIN_MODE 'true' 'false';

$html .= <<< EOT

<script type="text/javascript">

var 
$jsarray

/* create the Photo Note Container */
var container = document.getElementById('PhotoContainer');

var notes = new PhotoNoteContainer(container);

for (var n = 0; n < annotations.length; n++){

/* create a note */
var size = new PhotoNoteRect(annotations[n].posx, annotations[n].posy, annotations[n].width, annotations[n].height);
var note = new PhotoNote(annotations[n].note,'note' + n, size);

/* implement the save/delete functions */
note.onsave = function (note) { return ajax_save(note); };
note.ondelete = function (note) { return ajax_delete(note); };

/* assign the note id number */
note.nid = annotations[n].nid;

/* if (!
$admin && note.user_id != $user_id) note.editable = false; */

/* add it to the container */
notes.AddNote(note);
}

notes.HideAllNotes();

addEvent(container, 'mouseover', function() {
         notes.ShowAllNotes();
    });
    
 addEvent(container, 'mouseout', function() {
         notes.HideAllNotes();
    });

function addnote(){

var newNote = new PhotoNote('','note' + n,new PhotoNoteRect(10,10,50,50));
newNote.onsave = function (note) { return ajax_save(note); };
newNote.ondelete = function (note) { return ajax_delete(note); };
notes.AddNote(newNote);
newNote.Select();
newNote.nid = 0;

return false;
}

function ajax_save(note){

var data = 'add=' + 
{$CURRENT_PIC_DATA['pid']} + '&nid=' + note.nid + '&posx=' + note.rect.left + '&posy=' + note.rect.top + '&width=' + note.rect.width + '&height=' + note.rect.height + '&note=' + escape(note.text);

annotate_request(data, note);

return true;
}

function ajax_delete(note){

var data = 'remove=' + note.nid;

annotate_request(data, note);

return true;
}

</script>


EOT;

}

return $CURRENT_PIC_DATA;
}

// Based on code by Rob Williams
//Convert a PHP array to a JavaScript one (rev. 4)
function arrayToJS4($array$baseName) {

$return '';

   
//Write out the initial array definition
   
$return .= ($baseName " = new Array(); \r\n ");    

   
//Reset the array loop pointer
   
reset ($array);

   
//Use list() and each() to loop over each key/value
   //pair of the array
   
while (list($key$value) = each($array)) {
      if (
is_numeric($key)) {
         
//A numeric key, so output as usual
         
$outKey "[" $key "]";
      } else {
         
//A string key, so output as a string
         
$outKey "['" $key "']";
      }
      
      if (
is_array($value)) {
         
//The value is another array, so simply call
         //another instance of this function to handle it
         
$return .= arrayToJS4($value$baseName $outKey);
      } else {

         
//Output the key declaration
         
$return .= ($baseName $outKey " = ");      

         
//Now output the value
         
if (is_numeric($value)){
         
$return .= ($value "; \r\n ");
         } else if (
is_string($value)) {
            
//Output as a string, as we did before       
            
$return .= ("'" $value "'; \r\n ");
         } else if (
$value === false) {
            
//Explicitly output false
            
$return .= ("false; \r\n ");
         } else if (
$value === NULL) {
            
//Explicitly output null
            
$return .= ("null; \r\n ");
         } else if (
$value === true) {
            
//Explicitly output true
            
$return .= ("true; \r\n ");
         } else {
            
//Output the value directly otherwise
            
$return .= ($value "; \r\n ");
         }
      }
   }
   
   return 
$return;
}


function 
annotate_install() {
    global 
$thisplugin$CONFIG;

$sql "DROP TABLE IF EXISTS `{$CONFIG['TABLE_PREFIX']}notes`";
cpg_db_query($sql);

$sql = <<< EOT

CREATE TABLE IF NOT EXISTS `
{$CONFIG['TABLE_PREFIX']}notes` (
  `nid` smallint(5) unsigned NOT NULL auto_increment,
  `pid` mediumint(8) unsigned NOT NULL,
  `posx` smallint(5) unsigned NOT NULL,
  `posy` smallint(5) unsigned NOT NULL,
  `width` smallint(5) unsigned NOT NULL,
  `height` smallint(5) unsigned NOT NULL,
  `note` text NOT NULL,
  `user_id` smallint(5) unsigned NOT NULL,
  PRIMARY KEY  (`nid`),
  KEY `pid` (`pid`)
) TYPE=MyISAM ;

EOT;

return cpg_db_query($sql);
 }
Logged
Pages: 1 2 [3] 4 5 6 7 8   Go Up
 

Page created in 0.024 seconds with 21 queries.