Here users from all over the world gather around to learn the latest about Chevereto and contribute with ideas to improve the software.
Please keep in mind:
If this problem still exists.thrill said:wait! after i change to this mod, my remote upload tab doesn't work... what's the problem..?
This admin panel only works if you install it from the start. Since all images have to be in its db.AndreasHW said:Hi, i have install this nice software and i have in dir/images about 1100 images.
Then i install this mod( Admin-panel (MySQL)) and almost all are ok except i dont have images in admin panel as you see (i hope understand what i mean with poor english)
http://tinyurl.com/33byehp
<?php
// timer FTW
$mtime = microtime();
$mtime = explode(" ",$mtime);
$mtime = $mtime[1] + $mtime[0];
$starttime = $mtime;
echo "<h1>Admin importer thing by Gamerlv</h1>";
echo "<h2>Warning, this script may run ALOT of mysql queries!</h2>";
echo "<p>So make sure you have engouht time to let it run.</p>";
echo "<p>This takes about 0.001527 seconds per image (that's what it takes on my pc :D)</p>";
echo "<form action=\"\">
<p><input type=\"hidden\" value=1 name=\"ihavethetime\" /></p>
<input type=\"submit\" value=\"I have the time\" />
</form>";
if (!isset($_GET['ihavethetime']) || !$_GET['ihavethetime'])
die(); //no need to go any futher.
require_once('config.php');
require_once('db_connect.php');
#This header only is for the function getImages
# Original PHP code by Chirp Internet: [url=http://www.chirp.com.au]www.chirp.com.au[/url]
# Please acknowledge use of this code by including this header.
# 25% rewitten by Gamerlv
function getImages($dir)
{
$cachefile = "cache.import";
if (file_exists($cachefile)){
$cache = explode("|||" ,file_get_contents($cachefile));
if (time() - $cache[0] > 172800) {
return $cache;
}
unset($cache);
}
$imagetypes = array("image/jpeg", "image/gif", "image/png", "image/bmp");
# array to hold return value
$retval = array();
$return = array();
# add trailing slash if missing
if(substr($dir, -1) != "/") $dir .= "/";
# full server path to directory
$fulldir = getcwd()."/".$dir;
$d = @dir($fulldir) or die("getImages: Failed opening directory ".$dir." for reading <br />In ".getcwd() );
while(false !== ($entry = $d->read())) {
# skip hidden files
if($entry[0] == ".") continue;
if (!function_exists('mime_content_type'))
{
function mime_content_type($file)
{
//!!!!!THIS ONLY WORKS @ LINUX!!!!!!!
return trim(exec('file -bi ' . escapeshellarg($file)));
}
}
# check for image files
if(in_array(mime_content_type($fulldir.$entry), $imagetypes)) {
$retval[] = array(
'path' => "/".$dir.$entry,
'name' => $entry
);
}
}
$d->close();
$return[0] = time();
foreach($retval as $key => $value)
{
$five = substr($value['name'], 0 , 6);
if ( !($five == "thumb_") && !($five == "editor") ){
unset($five);
$return[] = $value['name'];
echo "I found ". $value['name'] ."<br />\n";
}
}
unset($retval);
if (file_exists($cachefile)){
$cache = implode("|||" ,$return);
file_put_contents($cachefile, $cache);
}
return $return;
}
//For admin-panel.
$now=mktime(date("H"),date("i"),date("s"),date("m"),date("d"),date("Y"));
$uid=0;
$created=$now;
$lastviewed=0;
$submitip=$_SERVER["REMOTE_ADDR"] or "127.0.0.1";
$views=0;
$picfsize=0;
$pic_width=0;
$pic_height=0;
$tamano = 0;
echo "<br /><p>Okay, here we go, I'm now starting to look for your images.</p><br />\n";
if (isset($config))
{
$images = getImages($config['dir']['images']);
} elseif (isset($_GET['folder']) && $_GET['sec'] == "Ag5Fw4afbhFP52" ) {
$images = getImages($_GET['folder']); //for testing
define("DIR_IM", $_GET['folder']."/");
} else {
$images = getImages(DIR_IM);
}
//For admin-panel. Send info about img to DB.
/*mysql_query("insert into pics(created,lastviewed,pictype,submitip,picfsize,uniqid,pic_width,pic_height)
values(
".$created.",
".$lastviewed.",
'".$exten."',
'".$submitip."',
".$tamano.",
'".$name."',
".$ancho.",
".$alto."
)");*/
echo "<h3>-=Got the images, lets import them=-</h3>\n";
$i = 0;
$c = 0;
$query = "insert IGNORE into pics(created,lastviewed,pictype,submitip,picfsize,uniqid,pic_width,pic_height) values";
foreach ($images as $key => $image)
{
if ($key == 0) continue;
echo "Generating sql on " . $image . "<br />\n";
$exten = substr($image, -3);
list($width, $height) = getimagesize(DIR_IM . $image);
$query .= " (
".$created.",
".$lastviewed.",
'".$exten."',
'".$submitip."',
".$tamano.",
'".$image."',
".$width.",
".$height."
)";
if ($i == 60){
echo "<h3>-=Running the query to not make it too long=-</h3>\n";
mysql_query($query); //excute, so it doesn't become to big
$i = 0;// rest count
//die("lets stop right here. <br />". $query); //debug
$query = "insert IGNORE into pics(created,lastviewed,pictype,submitip,picfsize,uniqid,pic_width,pic_height) values"; //start fresh
} else {
$query .= ",";
}
$i++; $c++; //add one to count
}
// yeay timing
$mtime = microtime();
$mtime = explode(" ",$mtime);
$mtime = $mtime[1] + $mtime[0];
$endtime = $mtime;
$totaltime = ($endtime - $starttime);
echo "<br />
<br />
<p>Okay, where all done.</p>
<p>In total I imported: ".$c." images and this took ".$totaltime." seconds.</p>
That's " . $totaltime / $c . " seconds per image <br /> ps, dont forget to delete me.";
?>
yes i understand but when i install this mod i have in db many images and i see in admin panel but without pictures, is easy to fix this someboby?gamerlv said:This admin panel only works if you install it from the start. Since all images have to be in its db.AndreasHW said:Hi, i have install this nice software and i have in dir/images about 1100 images.
Then i install this mod( Admin-panel (MySQL)) and almost all are ok except i dont have images in admin panel as you see (i hope understand what i mean with poor english)
http://tinyurl.com/33byehp
I have recently done some image work, I might be able to make a import script.
AndreasHW said:yes i understand but when i install this mod i have in db many images and i see in admin panel but without pictures, is easy to fix this someboby?gamerlv said:This admin panel only works if you install it from the start. Since all images have to be in its db.AndreasHW said:Hi, i have install this nice software and i have in dir/images about 1100 images.
Then i install this mod( Admin-panel (MySQL)) and almost all are ok except i dont have images in admin panel as you see (i hope understand what i mean with poor english)
http://tinyurl.com/33byehp
I have recently done some image work, I might be able to make a import script.
thrill said:wait! after i change to this mod, my remote upload tab doesn't work... what's the problem..?