/** * Guardamos una im?gen */ function rmmfSaveImg() { global $db, $mc; $id = isset($_POST['id']) ? $_POST['id'] : 0; if ($id <= 0) { header('location: index.php'); die; } include_once '../class/work.class.php'; $work = new MFWork($id); if (!$work->getVar('found')) { redirect_header('index.php', 1, _MA_RMMF_ERRNOEXIST); die; } $dir = rmmf_add_slash($mc['storedir']); if (!is_uploaded_file($_FILES['archivo']['tmp_name'])) { redirect_header('index.php?op=imgs&id=' . $id, 1, _MA_RMMF_ERRIMG); die; } include_once XOOPS_ROOT_PATH . '/class/uploader.php'; $upload = new XoopsMediaUploader($mc['storedir'], array('image/gif', 'image/jpeg', 'image/pjpeg', 'image/jpg', 'image/pjpg', 'image/x-png', 'image/png'), 1024 * 1024); $ext = strrchr($_FILES['archivo']['name'], "."); $ext = strtolower($ext); do { $newname = rmmf_make_random(8, 'mfex') . $ext; } while (file_exists($dir . $newname)); $upload->setTargetFileName($newname); $upload->fetchMedia('archivo'); if (!$upload->upload()) { redirect_header("?op=imgs&id=" . $id, 1, $upload->getErrors()); exit; } else { $newname = $upload->getSavedFileName(); } // Redimensionamos las im?genes rmmf_image_resize($dir . $newname, $dir . $newname, $mc['imgw'], $mc['imgh']); if (!is_dir($dir . 'ths/')) { mkdir($dir . 'ths/', 0777); } //rmmf_image_resize($dir . $newname, $dir . 'ths/' . $newname, $mc['thw'], $mc['thh']); resize_then_crop($dir . $newname, $dir . 'ths/' . $newname, $mc['thw'], $mc['thh'], 255, 255, 255); // Guardamos en la base de datos $db->query("INSERT INTO " . $db->prefix("rmmf_images") . " (`archivo`,`work`)\n\t\t\tVALUES ('{$newname}', '{$id}')"); if ($db->error() != '') { redirect_header('index.php?op=imgs&id=' . $id, 2, sprintf(_MA_RMMF_ERRDB, $db->error())); die; } else { redirect_header('index.php?op=imgs&id=' . $id, 2, ''); die; } }
* @copyright: © 2006. BitC3R0. * * @autor: BitC3R0 * * @paquete: RMSOFT GS 2.0 * * @version: 1.0.4 * * @modificado: 24/05/2006 12:52:24 a.m. * *******************************************************************/ include 'header.php'; $id = isset($_GET['id']) ? $_GET['id'] : 0; if ($id <= 0) { header('location: index.php'); die; } $xoopsOption['template_main'] = 'rmmf_view.html'; $tpl->assign('localize_bar', ":: <a href='index.php'>{$mc['title']}</a>" . rmmf_localize($id, 1)); include_once 'class/work.class.php'; $work = new MFWork($id); $tpl->assign('work', array('id' => $work->getVar('id_w'), 'titulo' => $work->getVar('titulo'), 'desc' => $myts->makeTareaData4Show($work->getVar('desc')), 'cliente' => $work->getVar('cliente'), 'comentario' => $myts->makeTareaData4Show($work->getVar('comentario')), 'url' => $work->getVar('url'), 'imagen' => $work->getVar('imagen'))); $tpl->assign('lang_for', _RMMF_FOR); $tpl->assign('lang_desc', _RMMF_DESC); $tpl->assign('lang_url', _RMMF_URL); $tpl->assign('lang_comment', sprintf(_RMMF_COMMENT, $work->getVar('cliente'))); $tpl->assign('lang_moreimgs', _RMMF_MOREIMAGES); foreach ($work->getVar('images') as $k => $v) { $tpl->append('images', $v['archivo']); } $xmh = "<script type=\"text/javascript\">\n<!--\n\tfunction cambiar(img){\n\t\tdocument.getElementById(\"pics\").src = '" . rmmf_add_slash(rmmf_web_dir($mc[storedir])) . "' + img\n\t}\n\t\n//-->\n</script>"; $xoops_module_header .= $xmh; $xoops_module_header .= '<script type="text/javascript" src="js/prototype.js"></script> <script type="text/javascript" src="js/scriptaculous.js?load=effects"></script> <script type="text/javascript" src="js/lightbox.js"></script> <link rel="stylesheet" href="css/lightbox.css" type="text/css" media="screen" />';