# PURPOSE. See the GNU General Public License # for more details. # # You should have received a copy of the GNU # General Public License along with Exponent; if # not, write to: # # Free Software Foundation, Inc., # 59 Temple Place, # Suite 330, # Boston, MA 02111-1307 USA # # $Id: captcha.php,v 1.6 2005/02/19 00:40:17 filetreefrog Exp $ ################################################## include_once dirname(realpath(__FILE__)) . '/pathos.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 (pathos_sessions_isset($name)) { $str = pathos_sessions_get($name); } else { $str = strtoupper(substr(md5(rand()), 17, 6)); pathos_sessions_set($name, $str); } $img = pathos_image_captcha($w, $h, $str); if ($img) { $sizeinfo = array('mime' => 'image/png'); ob_end_clean(); pathos_image_output($img, $sizeinfo); }
$original = $db->selectObject('imageworkshop_image', 'id=' . $_POST['id']); if ($original) { $working = $db->selectObject('imageworkshop_imagetmp', 'original_id=' . $original->id); if ($working) { $original->file_id = $working->file_id; } $file = $db->selectObject('file', 'id=' . $original->file_id); $file->_path = BASE . $file->directory . '/' . $file->filename; $wfile = null; if ($working == null) { $working = imageworkshopmodule::createWorkingCopy($original, $file); $wfile = $working->_file; unset($working->_file); } else { $wfile = $db->selectObject('file', 'id=' . $working->file_id); } $wfile->_path = BASE . $wfile->directory . '/' . $wfile->filename; if (!defined('SYS_IMAGE')) { require_once BASE . 'subsystems/image.php'; } $newimg = pathos_image_scaleManually($file->_path, $_POST['width'], $_POST['height']); if (is_resource($newimg)) { pathos_image_output($newimg, pathos_image_sizeinfo($file->_path), $wfile->_path); pathos_flow_redirect(); } else { echo $newimg; } } else { echo SITE_404_HTML; } // END PERM CHECK
include_once 'subsystems/image.php'; if (isset($_GET['id'])) { include_once 'subsystems/config/load.php'; // Initialize the Database Subsystem include_once BASE . 'subsystems/database.php'; $db = pathos_database_connect(DB_USER, DB_PASS, DB_HOST . ':' . DB_PORT, DB_NAME); $file_obj = $db->selectObject('file', 'id=' . $_GET['id']); $_GET['file'] = $file_obj->directory . '/' . $file_obj->filename; } $file = BASE . $_GET['file']; $thumb = null; if (isset($_GET['constraint'])) { $thumb = pathos_image_scaleToConstraint($file, $_GET['width'], $_GET['height']); } else { if (isset($_GET['width'])) { $thumb = pathos_image_scaleToWidth($file, $_GET['width']); } else { if (isset($_GET['height'])) { $thumb = pathos_image_scaleToHeight($file, $_GET['height']); } else { if (isset($_GET['scale'])) { $thumb = pathos_image_scaleByPercent($file, $_GET['scale'] / 100); } } } } if (is_resource($thumb)) { pathos_image_output($thumb, pathos_image_sizeinfo($file)); } else { pathos_image_showFallbackPreviewImage(BASE, $thumb); }