$data['path'] = ""; } if ($data['albumid'] > 0) { if (empty($data['name'])) { $error = $lang_module['err_null_name']; } else { if (empty($data['v_path'])) { $error = $lang_module['err_null_path']; } elseif (empty($error)) { if ($id == 0) { $num = $db->sql_numrows($adb->getAlbumImgs($data['albumid'])); if (empty($data['name'])) { list($mo, $data['name']) = split('[/.]', $data['path']); // } if ($adb->addNewImg($data['name'], $data['alias'], $data['path'], nv_editor_nl2br($data['description']), $thumb_name, $data['albumid'], $num + 1, $data['v_path'], $data['is_show'])) { $adb->update_numphoto($data['albumid']); $adb->freeResult(); Header("Location: " . NV_BASE_ADMINURL . "index.php?" . NV_NAME_VARIABLE . "=" . $module_name . "&" . NV_OP_VARIABLE . "=listimg&idb=" . $data['albumid']); die; } else { $error = $lang_module['err_save_img']; } } else { if ($adb->updateImgInfo($data['pictureid'], $data['name'], $data['alias'], $data['path'], nv_editor_nl2br($data['description']), $thumb_name, $data['albumid'], $data['v_path'], $data['is_show'])) { $adb->update_numphoto($data['albumid']); $adb->freeResult(); Header("Location: " . NV_BASE_ADMINURL . "index.php?" . NV_NAME_VARIABLE . "=" . $module_name . "&" . NV_OP_VARIABLE . "=listimg&idb=" . $data['albumid']); die; } else { $error = $lang_module['err_save_img'];
$max_y = round($max_x * $height / $width); } $image = new image($homeimgfile, NV_MAX_WIDTH, NV_MAX_HEIGHT); $image->resizeXY($max_x, $max_y); $image->save(NV_UPLOADS_REAL_DIR . '/' . $module_name . '/thumb', $basename); $image_info = $image->create_Image_info; $image->close(); $thumb_name = str_replace(NV_UPLOADS_REAL_DIR . '/' . $module_name . '/', '', $image_info['src']); $lu = strlen(NV_BASE_SITEURL . NV_UPLOADS_DIR . "/" . $module_name . "/"); $data['path'] = substr($data['path'], $lu); if ($id == 0) { $num = $db->sql_numrows($adb->getAlbumImgs($data['albumid'])); if (empty($data['name'])) { list($tmh, $data['name']) = split('[/.]', $data['path']); } if ($adb->addNewImg($data['name'], $data['path'], $data['description'], $thumb_name, $data['albumid'], $num + 1)) { $adb->update_numphoto($data['albumid']); $adb->freeResult(); Header("Location: " . NV_BASE_ADMINURL . "index.php?" . NV_NAME_VARIABLE . "=" . $module_name . "&" . NV_OP_VARIABLE . "=listimg&idb=" . $data['albumid']); die; } else { $error = $lang_module['err_save_img']; } } else { if ($adb->updateImgInfo($data['pictureid'], $data['name'], $data['path'], $data['description'], $thumb_name, $data['albumid'])) { $adb->update_numphoto($data['albumid']); $adb->freeResult(); Header("Location: " . NV_BASE_ADMINURL . "index.php?" . NV_NAME_VARIABLE . "=" . $module_name . "&" . NV_OP_VARIABLE . "=listimg&idb=" . $data['albumid']); die; } else { $error = $lang_module['err_save_img'];