andy's php projects
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
Script and site usage:
All of the scripts on this site are provided free for non-commerical, personal or non-profit use. If you find these scripts useful to you, appreciate the free support, or are just an all round nice person, then why not donate a little dosh? If you wish to use any of these in a commercial system, please refer to the payment plan.


New version now online!

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    php.amnuts.com Forum Index -> Crop Canvas
View previous topic :: View next topic  
Author Message
amnuts
Site Admin


Joined: 01 Sep 2002
Posts: 662
Location: East Sussex, England

PostPosted: Wed Nov 29, 2006 10:10 am    Post subject: New version now online! Reply with quote

I'm pleased to announce that I have just uploaded a new version of the cropping interface to the website!

This new version brings in a major new feature and fixes a fairly major issue people were having.

New functionality

If you've ever tried to crop a really, really large image (say 1900x1200 pixels in size) then you'd have noticed that the cropping interface is really big and almost impossible to use unless you're on a really big monitor. Well, this is no longer a problem! You can now define a maximum display size for the cropping interface while still keeping your original image large and having the crop happen in the correct place. By that I mean you could have the interface be 300x200 pixels and the crop be in the correct place on a 1900x1200 image.

This new method is called setMaxDisplaySize.

Fixed functionality

People were running in to problems when they had wrapped other html around the interface. This has required the splitting up of some of the javascript and going back to using two methods to display the interface; loadInterface and now the new loadJavascript.

Added methods

Some extra methods have been added to cater for the above. They are:

setMaxDisplaySize
loadJavascript
getImageWidth
getImageHeight
getImageSource
showImageAtSize

An example of use, showing the new functionality is:

PHP:
<?php <?php

/**
 * $Id: test.cropinterface.php 49 2006-11-29 14:35:46Z Andrew $
 *
 * [Description]
 *
 * Example file for class.cropinterface.php.
 *
 * [Author]
 *
 * Andrew Collington <php@amnuts.com> <http://php.amnuts.com/>
 */

require('class.cropinterface.php');
$ci =& new CropInterface(true);

if (isset(
$_GET['file'])) {
    
$ci->loadImage($_GET['file']);
    
$ci->cropToDimensions($_GET['sx'], $_GET['sy'], $_GET['ex'], $_GET['ey']);
    
$ci->showImage('png'100);
    exit;
}

?>

<html>

<body>

<div style=&quot;margin:5em;&quot;>

<?php

$ci
->setCropAllowResize(true);
$ci->setCropTypeDefault(ccRESIZEANY);
$ci->setCropTypeAllowChange(true);
$ci->setCropSizeDefault('2/2');
$ci->setCropPositionDefault(ccCENTRE);
$ci->setCropMinSize(1010);
$ci->setExtraParameters(array('test' => '1''fake' => 'this_var'));
$ci->setCropSizeList(array(
        
'200x200' => '200 x 200 pixels',
        
'320x240' => '320 x 240 pixels',
        
'3:5'     => '3x5 portrait',
        
'5:3'     => '3x5 landscape',
        
'8:10'    => '8x10 portrait',
        
'10:8'    => '8x10 landscape',
        
'4:3'     => 'TV screen',
        
'16:9'    => 'Widescreen',
        
'2/2'     => 'Half size',
        
'4/2'     => 'Quater width and half height'
        
));
$ci->setMaxDisplaySize('300x300');
$ci->loadInterface('mypicture.jpg');

?>

</div>

<?php $ci->loadJavascript(); ?>

</body>
</html> ?>


The files are now available for download on the main site, and a zip file is available with all the relevant files in it.
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger MSN Messenger
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    php.amnuts.com Forum Index -> Crop Canvas All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group