migration My-egallery vers coppermine migration My-egallery vers coppermine
 

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]

Main Menu

migration My-egallery vers coppermine

Started by philou5672, September 12, 2008, 09:36:31 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

philou5672

bonjour

Mon site tourne sur pragmamx et j'ai le module my-Egallery que j'aimerai convertir vers coppermine?

est ce possible existe t'il un convertisseur?


merci

François Keller

Pas à ma connaissance, mais je ne connais pas My-egallery.
Avez vous regardé sur le forum de pragmamx ?
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

philou5672

#2
non je suis venu ici avant mais je vais aller poster ma question sur le Forum eGallery !

merci

philou5672

Bien visiblement personne n'a de réponse lol  ???

Pascal YAP

Tentez de Contacter le Support eGallery !
Nous ne connaissons pas eGallery, ni tous les scripts disponibles... Nous tentons modestement de soutenir Coppermine  ;)

Pascal YAP

Nouveauté que je n'ai pas exploré simplement parce que je n'ai pas de eGallery  ???
http://forum.coppermine-gallery.net/index.php/topic,29149.msg134909.html#msg134909

Les instructions sont présentes au début de ce script.

Version 0.1 !
<pre><?
  /* My_eGallery converter 0.1
  ** Slapped together on 14.3.2006 by mnt /ät/ codeninja.de
  **
  ** Copy all your files from gallery/ to albums/
  ** Just stringreplace "cpg_" with your own prefix, eg. "gpc144_"
  ** Do the same if your nuke-prefix isn't "nuke_"
  **
  ** Consider temporarily raising the php memory limit if you got very big jpegs in your gallery
  **
  ** This script also generates thumbs and normals, because admin_tools are a pain in the ass in my opinion
  ** gallery.gif and thumb/ will be removed, as no longer needed
  */

  error_reporting(E_ALL);
  set_time_limit(0);
  @mysql_connect("localhost","xxx","xxx");
  @mysql_select_db("xxx");

//  mysql_query("TRUNCATE TABLE `cpg_albums`");
//  mysql_query("TRUNCATE TABLE `cpg_pictures`");
//  mysql_query("TRUNCATE TABLE `cpg_comments`");

////////////////////////////////////////////////////////////////////////////////

   if (!function_exists('scandir')) {
      function scandir($dir = './', $sort = 0) {
         $dir_open = @ opendir($dir);
         if (! $dir_open) return false;
         while (($dir_content = readdir($dir_open)) !== false) $files[] = $dir_content;
         if ($sort == 1) rsort($files, SORT_STRING);
         else sort($files, SORT_STRING);
         return $files;
      }
   }

  //lifted from pixtool resize_func:
  function doresize($filename,$target,$maxsize,$maxsizey=false,$forceoverwrite=false,$onlydown=false){
   if (!file_exists("$filename")) { return false; }
   
   if ($maxsizey==false) { $maxsizey=$maxsize; }
   
   if (!file_exists($filename)) { return false; }
   if (file_exists("$target")) { if (!$forceoverwrite) { return false; } }
   
    $groessen=@getimagesize($filename);
    $o_width=$groessen[0];
    $o_height=$groessen[1];
    if ($o_width==0) { return; }
    $d_width=$o_width/$maxsize;
    $d_height=$o_height/$maxsizey;
   
    if ($d_width>=$d_height) { //querformat
      $n_width=$maxsize;
      $n_height=round($o_height/$d_width);
     } else {
      $n_height=$maxsizey;
      $n_width=round($o_width/$d_height);
     }
   
     if ($onlydown) {
        if (($n_width>=$o_width) and ($n_height>=$o_height)) { return false; }
     }
   
     switch ($groessen[2]) {
        case 1: $image = imagecreatefromgif($filename); break;
        case 2: $image = imagecreatefromjpeg($filename); break;
        case 3: $image = imagecreatefrompng($filename); break;
     }
   
     if ($image) {
       $tn = imagecreatetruecolor($n_width,$n_height);
       imagecopyresampled($tn,$image,0,0,0,0,$n_width,$n_height,$o_width,$o_height);
       switch ($groessen[2]) {
         case 1:imagegif($tn,"$target");
         case 2:imagejpeg($tn,"$target",80); break;
         case 3:imagepng($tn,"$target"); break;
       }
       imagedestroy($tn);
     }
     @imagedestroy($image);
   
     return true;
  }
   
////////////////////////////////////////////////////////////////////////////////

  $config=array('alb_list_thumb_size','picture_width','max_upl_width_height','normal_pfx','thumb_pfx');
  foreach ($config as $k) {
     $r=mysql_query("SELECT value FROM cpg_config WHERE name='$k'");
     $config[$k]=mysql_result($r,0);
  }

  $r=mysql_query("SELECT * FROM nuke_gallery_categories ORDER BY gallid ASC");
  while ($rows=mysql_Fetch_assoc($r)) {
     $sql="INSERT INTO cpg_albums (aid,title,description,pos) VALUES (
     '".mysql_escape_string($rows['gallid'])."',
     '".mysql_escape_string($rows['gallname'])."',
     '".mysql_escape_string($rows['description'])."',
     '-".mysql_escape_string($rows['gallid'])."')";

     $path='albums/'.$rows['galloc'].'/';

     echo "$sql\n"; mysql_query($sql);

     if (file_exists($path.'gallery.gif')) {
        unlink($path.'gallery.gif');
     }

     if (is_dir($path.'thumb')) {
        $thumbs=scandir($path.'thumb/');
        foreach ($thumbs as $thumb) {
           if (!is_dir($path.'thumb/'.$thumb)) {
              unlink($path.'thumb/'.$thumb);
           }
        }
        rmdir($path.'thumb/');
     }

     $r2=mysql_query("SELECT * FROM nuke_gallery_pictures WHERE gid=".$rows['gallid']." ORDER BY pid ASC");
     while ($rows2=mysql_fetch_assoc($r2)) {

        $filename=$path.$rows2['img'];
        $normname=$path.$config['normal_pfx'].$rows2['img'];
        $thmbname=$path.$config['thumb_pfx'].$rows2['img'];

        $size=filesize($path.$rows2['img']);
        $tsize=$size;

        doresize($filename,$thmbname,$config['alb_list_thumb_size'],false,false,true);

        $psize=getimagesize($filename);
        if (($psize[0]>$config['picture_width']) or ($psize[1]>$config['picture_width'])) {
           doresize($filename,$normname,$config['picture_width'],false,false,true);
           $tsize=$size+filesize($normname);
        }

        $sql="INSERT INTO cpg_pictures (pid,aid,filepath,filename,filesize,total_filesize,pwidth,pheight,hits,ctime,owner_id,owner_name,approved) VALUES (
             '".mysql_escape_string($rows2['pid'])."',
             '".mysql_escape_string($rows2['gid'])."',
             '".mysql_escape_string($rows['galloc'])."/',
             '".mysql_escape_string($rows2['img'])."',
             '".mysql_escape_string($size)."',
             '".mysql_escape_string($tsize)."',
             '".mysql_escape_string($rows2['width'])."',
             '".mysql_escape_string($rows2['height'])."',
             '".mysql_escape_string($rows2['counter'])."',
             '".mysql_escape_string(strtotime($rows2['date']))."',
             '1',
             'mnt',
             'YES')";

             echo "$sql\n"; mysql_query($sql);
     }
  }

  $r=mysql_query("SELECT * FROM nuke_gallery_comments");
  while ($rows=mysql_Fetch_assoc($r)) {
     $sql="INSERT INTO cpg_comments (pid,msg_author,msg_body,msg_date) VALUES (
     '".mysql_escape_string($rows['pid'])."',
     '".mysql_escape_string($rows['name'])."',
     '".mysql_escape_string($rows['comment'])."',
     '-".mysql_escape_string($rows['date'])."')";
     
     echo "$sql\n"; mysql_query($sql);
  }
?>*** All done.</pre>