Advanced search  

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Pages: [1]   Go Down

Author Topic: ajout bouton E-card plugin Enlargeit!  (Read 3536 times)

0 Members and 1 Guest are viewing this topic.

phanux

  • Coppermine novice
  • *
  • Offline Offline
  • Gender: Male
  • Posts: 24
    • Album photo familial
ajout bouton E-card plugin Enlargeit!
« on: February 23, 2009, 06:50:58 pm »

Bonjour à tous,

Je trouvais qu'il manquait un bouton à enlargit! pour envoyer une photo en E-card. N'aillant rien trouvé sur le forum, j'ai fais la modif (comme j'ai pu  :P) moi-même.
Si ça interresse quelqu'un voici comment j'ai fais :

 - créer un fichier nommé enl_ecard.php et y coller ceci:
Quote
<?php
/**************************************************
  Coppermine 1.4.x Plugin - EnlargeIt! $VERSION$=2.14
  *************************************************
  Copyright (c) 2008 Timos-Welt (www.timos-welt.de)
  *************************************************
  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 3 of the License, or
  (at your option) any later version.
  ***************************************************/

define('IN_COPPERMINE', true);
define('DISPLAYIMAGE_PHP', true);
define('INDEX_PHP', true);
define('UPLOAD_PHP', true);

require('include/init.inc.php');
global $ENLARGEITSET,$lang_enlargeit;
require('./plugins/enlargeit/include/load_enlargeitset.php');
/**
 * Main code
 */

$pos = isset($_GET['pos']) ? (int)$_GET['pos'] : 0;

/**
 * Hack added by tarique to prevent incorrect picture being seen on last view or last uploaded
 */

$pid = isset($_GET['pid']) ? (int)$_GET['pid'] : 0;
$cat = isset($_GET['cat']) ? (int)$_GET['cat'] : 0;
$album = isset($_GET['album']) ? $_GET['album'] : '';


//get_meta_album_set in functions.inc.php will populate the $ALBUM_SET instead; matches $META_ALBUM_SET.
get_meta_album_set($cat,$ALBUM_SET);
$META_ALBUM_SET = $ALBUM_SET; //displayimage uses $ALBUM_SET but get_pic_data in functions now uses $META_ALBUM_SET


// Retrieve data for the current picture
    $pid = ($pos < 0) ? -$pos : $pid;
    $result = cpg_db_query("SELECT aid from {$CONFIG['TABLE_PICTURES']} WHERE pid='$pid' $ALBUM_SET LIMIT 1");
    if (mysql_num_rows($result) == 0) cpg_die(ERROR, $lang_errors['non_exist_ap'], __FILE__, __LINE__);
    $row = mysql_fetch_array($result);
    $album = $row['aid'];
    $pic_data = get_pic_data($album, $pic_count, $album_name, -1, -1, false);
    for($pos = 0; $pic_data[$pos]['pid'] != $pid && $pos < $pic_count; $pos++);
    $pic_data = get_pic_data($album, $pic_count, $album_name, $pos, 1, false);
    $CURRENT_PIC_DATA = $pic_data[0];

$lien_ecard = '<a href="ecard.php?album=' . $CURRENT_PIC_DATA['aid'] . '&amp;pid='.$CURRENT_PIC_DATA['pid'].'&amp;pos=' . $pos .'>Envoyer cette photo en E-card</a>';

echo <<<EOT
   <table align="center" cellspacing="1" style="width:90%;height:90%">
      <tr><td class="enl_infotable" align="center">
      <p>La fonction E-card permet d'envoyer la photo sélectionnée comme <b>carte postale électronique</b> sur l'email du correspondant de votre choix</p>
      </td></tr>
      <tr><td class="enl_infotable" align="center">$lien_ecard</td></tr>
   </table>
EOT;

?>

puis copier le fichier à la racine de la galerie.

 - éditer le fichier : /plugins/enlargeit/codebase.php comme suit :
trouver
Quote
   ...
    $i = 0;
    if ($ENLARGEITSET['enl_buttonpic'])
    {
      $enlargeit_headcode .= "enl_buttonurl[".$i."] = 'pic';
    ";
      $enlargeit_headcode .= "enl_buttontxt[".$i."] = \"".$lang_enlargeit['enl_tooltippic']."\";
    ";
      $enlargeit_headcode .= "enl_buttonoff[".$i."] = 0;
    ";
    $i = $i + 1;
    }
    ...
chaque section comme celle-ci ( if ( ... ) { ... } ) détermine un bouton. Insérer ceci à l'emplacement où vous voulez voir apparaitre le bouton E-card :
Quote
      $enlargeit_headcode .= "enl_buttonurl[".$i."] = 'enl_ecard.php?pos=-';
    ";
      $enlargeit_headcode .= "enl_buttontxt[".$i."] = \"Envoyer cette photo en E-card\";
    ";
      $enlargeit_headcode .= "enl_buttonoff[".$i."] = -176;
    ";
    $i = $i + 1;

et le tour est joué.  ;D
Cela ouvre une page sommaire expliquant l'E-card avec un lien qui renvoi sur la page de l'E-card (ecard.php).

(Bon c'est un peu de la bidouille mais j'ai pas trouvé comment passer à la page ecard.php les variables nécessaire directement  ???,  si quelqu'un a mieu je suis preneur )

ps: dans la modif de codebase.php, je me suis servi aussi d'une info trouvé sur le forum pour interdire les favoris au guest : il suffit de modifier les boutons que l'on veut cacher comme ceci :
Quote
    if (USER_ID) {                    //ajout de if (USER_ID) { pour cacher le bouton au guest
    if ($ENLARGEITSET['enl_buttonfav'])
    {
      $enlargeit_headcode .= "enl_buttonurl[".$i."] = 'enl_addfav.php?pid=';
    ";
      $enlargeit_headcode .= "enl_buttontxt[".$i."] = \"".$lang_enlargeit['enl_tooltipfav']."\";
    ";
      $enlargeit_headcode .= "enl_buttonoff[".$i."] = -32;
    ";
    $i = $i + 1;
    }
    } // fin de if (USER_ID)


Logged

François Keller

  • Moderator
  • Coppermine addict
  • ****
  • Country: fr
  • Offline Offline
  • Gender: Male
  • Posts: 9094
  • aka Frantz
    • Ma galerie
Re: ajout bouton E-card plugin Enlargeit!
« Reply #1 on: February 23, 2009, 06:58:58 pm »

merci pour ce partage  ;)
Logged
Avez vous lu la DOC ? la FAQ ? et cherché sur le forum avant de poster ?
Did you read the DOC ? the FAQ ? and search the board before posting ?
Mon Blog

phanux

  • Coppermine novice
  • *
  • Offline Offline
  • Gender: Male
  • Posts: 24
    • Album photo familial
Re: ajout bouton E-card plugin Enlargeit!
« Reply #2 on: March 01, 2009, 09:47:34 pm »

Bonsoir à tous,

Je me suis aperçu d'un petit problème dans ma 'bidouille' d'enlargeit!  :-[ : la fonction fonctionne correctement sous firefox (Linux et Windows) et internet explorer (Windows, émulation Windows) mais ne fonctionne pas pour Opera (Linux, Windows pas testé) ou Konqueror (Linux).

Il faut donc modifier le fichier enl_ecard.php comme ceci :
chercher la ligne :
Quote
$lien_ecard = '<a href="ecard.php?album=' . $CURRENT_PIC_DATA['aid'] . '&amp;pid='.$CURRENT_PIC_DATA['pid'].'&amp;pos=' . $pos .'>Envoyer cette photo en E-card</a>';

et la remplacer par :
Quote
$ecard_tgt = "ecard.php?album=$album$cat_link&amp;pid=$pid&amp;pos=$pos";

puis chercher la ligne :
Quote
<tr><td class="enl_infotable" align="center">$lien_ecard</td></tr>

et la remplacer par :
Quote
<tr><td class="enl_infotable" align="center"><a href=$ecard_tgt title="E-card">Envoyer cette photo en E-card</a></td></tr>

et ça ira mieu  ;)

Testé fonctionnel sur Firefox (Linux, Windows), Internet Explorer (windows, émulation Windows), Opera (Linux, Windows), SeaMonkey et Konqueror (Linux).

En espérant n'avoir gêné personne.  :-\
Désolé  :-[
Logged

Timos-Welt

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 808
    • Timos-Welt
Logged
Pages: [1]   Go Up
 

Page created in 0.022 seconds with 19 queries.