Project

General

Profile

Bug #46020 » imagesize.php

Mathias Bolt Lesniak, 2013-12-12 20:51

 
<?php

$conf = include 'LocalConfiguration.php';

$c = mysql_connect(
$conf['DB']['host'],
$conf['DB']['username'],
$conf['DB']['password']
);

if(!$c) {
die('Could not connect: ' . mysql_error());
}
mysql_select_db($conf['DB']['database']);

$sql = 'SELECT * FROM sys_file WHERE width=0 AND height=0';
$result = mysql_query($sql);

if (!$result) {
echo "Could not successfully run query ($sql) from DB: " . mysql_error();
exit;
}


while ($row = mysql_fetch_assoc($result)) {
$filename = $row['identifier'];
if($row['storage'] == 1) {
$filename = '/fileadmin' . $filename;
}
$filename = '..' . $filename;
$mime = mime_content_type($filename);
list($width, $height) = getimagesize($filename);
$sql = 'UPDATE sys_file SET mime_type = \'' . $mime . '\', width = \'' . $width . '\', height = \'' . $height . '\' WHERE uid = ' . $row['uid'];
$r = mysql_query($sql);
if (!$r) {
echo "Could not successfully run query ($sql) from DB: " . mysql_error();
}
echo $sql . "\n\n";

}
?>
(5-5/8)