registration fix fixed
[mirrors/Kyberia-bloodline.git] / scripts / articleimages.php
1 <?php
2 //requiring main config file with path/database etc. constants
3 require('../config/config.inc');
4 //require('../config/config_pathz.inc');
5
6 //connecting to database and creating universal $db object
7 require(SYSTEM_ROOT.'/inc/log.inc');
8 require(SYSTEM_ROOT.'/inc/database.inc');
9 require(SYSTEM_ROOT.'/inc/nodes.inc');
10 $db=new CLASS_DATABASE();
11 $db_old=new CLASS_DATABASE("kyberia","kyberia","cyb3ry","127.0.0.1");
12 define('IMAGES','/storage/system/www-kyberia/images/clanky/');
13
14 $set=$db->query("select node_id,old_id from nodes where node_type='5'");
15 while ($set->next()) {
16 $oldset=$db_old->query("select title_image from articles where id_article='".$set->getString('old_id')."'");
17 $oldset->next();
18 $id=$set->getString('node_id');
19 $image=$oldset->getString('title_image');
20 if (!empty($image)) {
21 if (strstr($image,".gif")) {
22 copy(IMAGES.$image,"/storage/system/www-kyberia/images/nodes/".substr($id,0,1)."/".substr($id,1,1)."/$id.gif");
23 }
24
25 elseif ( strstr($image,".jpeg") || strstr($image,".jpg") || strstr($image,".JPG") ){
26 $cmd=UTILZ_DIR."/jpegtopnm ".IMAGES.$image." | ".UTILZ_DIR."/ppmquant 256 | ".UTILZ_DIR."/ppmtogif > /storage/system/www-kyberia/images/nodes/".substr($id,0,1)."/".substr($id,1,1)."/$id.gif";
27
28
29 echo $cmd."<br>";
30 shell_exec($cmd);
31
32 }
33
34
35 }
36 }
This page took 0.312893 seconds and 4 git commands to generate.