// Initialize the Database Subsystem include_once BASE . 'subsystems/database.php'; $db = exponent_database_connect(DB_USER, DB_PASS, DB_HOST . ':' . DB_PORT, DB_NAME); $file_obj = $db->selectObject('file', 'id=' . intval($_GET['id'])); $_GET['file'] = $file_obj->directory . '/' . $file_obj->filename; } $file = BASE . $_GET['file']; $thumb = null; if (isset($_GET['constraint'])) { $thumb = exponent_image_scaleToConstraint($file, $_GET['width'], $_GET['height']); } else { if (isset($_GET['width'])) { $thumb = exponent_image_scaleToWidth($file, intval($_GET['width'])); } else { if (isset($_GET['height'])) { $thumb = exponent_image_scaleToHeight($file, intval($_GET['height'])); } else { if (isset($_GET['scale'])) { $thumb = exponent_image_scaleByPercent($file, intval($_GET['scale']) / 100); } } } } $mythumb = getimagesize($file); if ($mythumb[0] > 0 && $mythumb[1] > 0) { if (is_resource($thumb)) { exponent_image_output($thumb, exponent_image_sizeinfo($file)); } else { exponent_image_showFallbackPreviewImage(BASE, $thumb); } }
# # This file is part of Exponent # # Exponent is free software; you can redistribute # it and/or modify it under the terms of the GNU # General Public License as published by the Free # Software Foundation; either version 2 of the # License, or (at your option) any later version. # # GPL: http://www.gnu.org/licenses/gpl.txt # ################################################## include_once dirname(realpath(__FILE__)) . '/exponent.php'; include_once dirname(realpath(__FILE__)) . '/subsystems/image.php'; $w = isset($_GET['w']) ? $_GET['w'] : 200; $h = isset($_GET['h']) ? $_GET['h'] : 50; $name = isset($_GET['name']) ? $_GET['name'] : 'capcha_string'; if (exponent_sessions_isset($name)) { $str = exponent_sessions_get($name); } else { $str = strtoupper(substr(md5(rand()), 17, 6)); exponent_sessions_set($name, $str); } if (intval($w) > 0 && intval($h > 0)) { $img = exponent_image_captcha($w, $h, $str); } if ($img) { $sizeinfo = array('mime' => 'image/png'); ob_end_clean(); exponent_image_output($img, $sizeinfo); }