i did steps again and now config page is ok and the mod work nice
i am beginner in php so i can't understand this step ( what exact code that i remove it and put this code )
replace the entire function update_thumbs() with
Code:
function update_thumbs()
{
global $CONFIG, $lang_util_php;
$albumid = (isset($_REQUEST['albumid'])) ? $_REQUEST['albumid'] : 0;
$albstr = ($albumid) ? "WHERE aid = $albumid" : '';
$autorefresh = $_REQUEST['autorefresh'];
$updatetype = $_REQUEST['updatetype'];
$numpics = $_REQUEST['numpics'];
$startpic = (isset($_REQUEST['startpic'])) ? $_REQUEST['startpic'] : 0;
echo "<h2>{$lang_util_php['thumbs_wait']}</h2>";
$result = cpg_db_query("SELECT * FROM {$CONFIG['TABLE_PICTURES']} $albstr LIMIT $startpic, $numpics");
$count = mysql_num_rows($result);
while ($row = mysql_fetch_assoc($result)){
$image = $CONFIG['fullpath'] . $row['filepath'] . $row['filename'];
$normal = $CONFIG['fullpath'] . $row['filepath'] . $CONFIG['normal_pfx'] . $row['filename'];
$thumb = $CONFIG['fullpath'] . $row['filepath'] . $CONFIG['thumb_pfx'] . $row['filename'];
$mini = $CONFIG['fullpath'] . $row['filepath'] . $CONFIG['mini_pfx'] . $row['filename'];
$orig=$CONFIG['fullpath'] . $row['filepath'] . $CONFIG['orig_pfx'] . $row['filename'];
if (file_exists($orig)) {
$work_image=$orig;
$orig_true='true';
} else {
$work_image=$image;
$orig_true='false';
}
$imagesize = getimagesize($work_image);
if ($updatetype == 0 || $updatetype == 2 || $updatetype == 5) {
if (resize_image($work_image, $thumb, $CONFIG['thumb_width'], $CONFIG['thumb_method'], $CONFIG['thumb_use'], "false", 1)) {
echo $thumb .' '. $lang_util_php['updated_succesfully'] . '!<br />';
my_flush();
} else {
echo $lang_util_php['error_create'] . ':$thumb<br />';
my_flush();
}
if ($CONFIG['enable_mini_thumbs'] == '1') {
if (resize_image($work_image, $mini, $CONFIG['mini_thumb_width'], $CONFIG['thumb_method'], "mini", "false", 1)) {
echo $mini .' '. $lang_util_php['updated_succesfully'] . '!<br />';
my_flush();
} else {
echo $lang_util_php['error_create'] . ':$mini<br />';
my_flush();
}
}
}
if ($updatetype == 1 || $updatetype == 2 || $updatetype == 3 || $updatetype == 5)
{
($CONFIG['enable_watermark'] == '1' && $CONFIG['which_files_to_watermark'] == 'both' || $CONFIG['which_files_to_watermark'] == 'resized') ? $watermark="true" : $watermark="false";
if (max($imagesize[0], $imagesize[1]) > $CONFIG['picture_width'] && $CONFIG['make_intermediate'])
{
if (resize_image($work_image, $normal, $CONFIG['picture_width'], $CONFIG['thumb_method'], $CONFIG['thumb_use'], $watermark))
{
echo $normal . " " . $lang_util_php['updated_succesfully'] . '!<br />';
my_flush();
}
else
{
echo $lang_util_php['error_create'] . ':$normal<br />';
my_flush();
}
}
}
if ($updatetype == 3 || $updatetype == 4 || $updatetype == 5)
{
($CONFIG['thumb_use'] == "ex") ? $resize_method = "any" : $resize_method = $CONFIG['thumb_use'];
if (((USER_IS_ADMIN && $CONFIG['auto_resize'] == 1) || (!USER_IS_ADMIN && $CONFIG['auto_resize'] > 0)) && max($imagesize[0], $imagesize[1]) > $CONFIG['max_upl_width_height']){ //$CONFIG['auto_resize']==1
$max_size_size = $CONFIG['max_upl_width_height'];
}
else {
$resize_method = "orig";
$max_size_size = max($imagesize[0], $imagesize[1]);
}
if ($orig_true == 'false')
{
if (copy($image, $orig))
{
if ($CONFIG['enable_watermark'] == '1' && $CONFIG['which_files_to_watermark'] == 'both' || $CONFIG['which_files_to_watermark'] == 'original')
{
if (resize_image($work_image, $image, $max_size_size, $CONFIG['thumb_method'], $resize_method, 'true'))
{
echo $image . " " . $lang_util_php['updated_succesfully'] . '!<br />';
my_flush();
}
else
{
echo $lang_util_php['error_create'] . ':$image<br />';
my_flush();
}
}
}
} else {
if ($CONFIG['enable_watermark'] == '1' && $CONFIG['which_files_to_watermark'] == 'both' || $CONFIG['which_files_to_watermark'] == 'original')
{
if (resize_image($work_image, $image, $max_size_size, $CONFIG['thumb_method'], $resize_method, 'true'))
{
echo $image . " " . $lang_util_php['updated_succesfully'] . '!<br />';
my_flush();
}
else
{
echo $lang_util_php['error_create'] . ':$image<br />';
my_flush();
}
} else {
if (((USER_IS_ADMIN && $CONFIG['auto_resize'] == 1) || (!USER_IS_ADMIN && $CONFIG['auto_resize'] > 0)) && max($imagesize[0], $imagesize[1]) > $CONFIG['max_upl_width_height']){
if (resize_image($work_image, $image, $max_size_size, $CONFIG['thumb_method'], $resize_method, 'false'))
{
echo $image . " " . $lang_util_php['updated_succesfully'] . '!<br />';
my_flush();
}
else
{
echo $lang_util_php['error_create'] . ':$image<br />';
my_flush();
}
} elseif (copy($orig, $image))
{
echo $orig . " " . $lang_util_php['updated_succesfully'] . '!<br />';
my_flush();
}
else
{
echo $lang_util_php['error_create'] . ':$image<br />';
my_flush();
}
}
}
}
$imagesize = getimagesize($image);
$query_up = "UPDATE {$CONFIG['TABLE_PICTURES']} SET pwidth='$imagesize[0]' , pheight='$imagesize[1]' WHERE pid='".$row['pid']."' ";
cpg_db_query($query_up);
}
if ($count == $numpics){
$startpic += $numpics;
if($autorefresh) {
echo <<< EOT
<meta http-equiv="refresh" content="1; URL=util.php?numpics={$numpics}&startpic={$startpic}&albumid={$albumid}&autorefresh={$autorefresh}&action=update_thumbs&updatetype={$updatetype}">
EOT;
}
else
{
echo <<< EOT
<form action="util.php" method="post">
<input type="hidden" name="action" value="update_thumbs" />
<input type="hidden" name="numpics" value="$numpics" />
<input type="hidden" name="startpic" value="$startpic" />
<input type="hidden" name="updatetype" value="$updatetype" />
<input type="hidden" name="albumid" value="$albumid" />
<input type="hidden" name="autorefresh" value="$autorefresh" />
<input type="submit" value="{$lang_util_php['continue']}" class="button" />
</form>
EOT;
}
}
else echo $lang_util_php['finished'];
}
function deletbackup_img()
{
global $CONFIG, $lang_util_php;
$albumid = (isset($_POST['albumid'])) ? $_POST['albumid'] : 0;
$albstr = ($albumid) ? "WHERE aid = $albumid" : '';
$result = cpg_db_query("SELECT * FROM {$CONFIG['TABLE_PICTURES']} $albstr");
$num = mysql_num_rows($result);
$i = 0;
while ($i < $num) {
$pid = mysql_result($result, $i, "pid");
$back = $CONFIG['fullpath'] . mysql_result($result, $i, "filepath") . $CONFIG['orig_pfx'] . mysql_result($result, $i, "filename");
if (file_exists($back)) {
if(unlink($back)){
printf("Success".$lang_util_php['main_success'], $back);
print '!<br>';
}
} else {
printf("Error".$lang_util_php['error_rename'], $back);
}
++$i;
}
}