V
volk15
Гость
Lange,
PHP:
$uploads_dir = 'pictures/';
$uploads_dir = 'pictures/';
$unlink = request_var('unlink', '');
if ($unlink && IS_AM)
{
if (file_exists(BB_ROOT . $unlink))
{
unlink(BB_ROOT . $unlink);
$th = str_replace('.', '_thumb.', $unlink);
if (file_exists(BB_ROOT . $th)) unlink(BB_ROOT . $th);
meta_refresh('gallery.php', 3);
bb_die('Deleted');
}
else
{
meta_refresh('gallery.php', 3);
bb_die('Deleted');
}
}
function create_thumb($uploads_dir, $name, $att)
{
$infile = $uploads_dir . $name . $att;
if ($att == ".jpg" || $att == ".jpeg") $im = imagecreatefromjpeg($infile);
elseif ($att == ".png") $im = imagecreatefrompng($infile);
elseif ($att == ".gif") $im = imagecreatefromgif($infile);
$oh = imagesy($im);
$ow = imagesx($im);
$r = $oh/$ow;
$newh = 200;
$neww = $newh/$r;
$outfile = $uploads_dir . $name ."_thumb". $att;
$im1 = imagecreatetruecolor($neww,$newh);
imagecopyresampled($im1, $im, 0, 0, 0, 0, $neww, $newh, imagesx($im), imagesy($im));
imagejpeg($im1, $outfile, 75);
imagedestroy($im);
imagedestroy($im1);
}
$unlink = request_var('unlink', '');
$if = (IS_AM) ? $unlink : $unlink && preg_match('#_'.$userdata['user_id'].'.#', $unlink);
if ($if)
{
if (file_exists(BB_ROOT . $unlink))
{
unlink(BB_ROOT . $unlink);
$th = str_replace('.', '_thumb.', $unlink);
if (file_exists(BB_ROOT . $th)) unlink(BB_ROOT . $th);
meta_refresh('gallery.php', 3);
bb_die('Deleted');
}
else
{
meta_refresh('gallery.php', 3);
bb_die('Deleted');
}
}
$name = md5($_FILES['pictures']['name'][$k]). '_'.$userdata['user_id'];
$thwd = (isset($_POST['width'])) ? $_POST['width'] : ''; //thumb width
if ($thwd < 170 or $thwd > 350) $thwd = 170;
в lang_main.php скиньА гидэ /lang_russian/lang_gallery.php