All pastes #775324 Raw Edit

Miscellany

public text v1 · immutable
·published 2007-11-15 15:40 UTC
rendered paste body
<?php

	// This script stores temporary image data in the user's session
	session_start(); 
	
	// The dimensions the uploaded image is resized to.
	// (The aspect ratio is maintained and no quality is lost during the final crop no matter how
	// small you set these values)
	$default_max_width = 640;
	$default_max_height = 480;

	// The size of the image the user will create:
	$cropped_width = 440;
	$cropped_height = 280;

	// A name for the session variable the script will use (must be unique for your domain)
	$unique_session_key = 'imgcropper';

	// A directory that the webserver can create files in, read from and delete files from
	// (the trailing slash is required)
	define('TEMP_DIR','temp/');

	// Before the user uploads their own image they get to play with this one:
	$default_image = 'http://photosharelive.com/files/{$_GET['file']}';

	// A semi transparent gif used to create the darkened effect around the edge of the page.
	$border_background = 'screen.gif';
	
	// After the user has chosen the area to crop, the cropped image is passed to the following 
	// function that you must write your own code for:
	function storeImage($img_id)
	{
		// $img_id is a GD image reference, if you want the actual JPEG data pass it to imgdata (as below)
		$_SESSION['imgcropper']['cropped'] = imgdata($img_id); 
	}
	// ...then the user is redirected to this page:	
	$redirect_after_crop = 'done.php';

	// All of the code:
	include("cropper-include.php");
	
?>