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.


Integration with phpBB

 
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
raygene
Newbie


Joined: 08 May 2007
Posts: 2
Location: Gatineau, QC, Canada

PostPosted: Wed May 09, 2007 11:04 am    Post subject: Integration with phpBB Reply with quote

Hi Andy,

I'm in the process of building a Free Dating site using phpbb 2.0.22 and I already have an image cropping script but it doesn't have all the functions that yours has (including the interactive cropping interface):

http://www.matesjunction.com/mjfdatebb/profile.php?mode=cropimg

I would like to replace the script with yours because I want a proportional 3X4 portrait crop mask as well as a minimum 120 X 160 image size (board default) so all of my member's photos are of equal size. If the image is larger than the default, it will be resized when the user uploads his/her photo by the "Resize Avatar on Upload" mod.

If possible, could you walk me through this? If we can integrate your scripts to work on my site, I will gladly make a donation.

Cheers,
Raygene
Back to top
View user's profile Send private message
raygene
Newbie


Joined: 08 May 2007
Posts: 2
Location: Gatineau, QC, Canada

PostPosted: Thu May 10, 2007 3:24 pm    Post subject: Yo Andy Reply with quote

Still around?

Cheers,
Raygene
Back to top
View user's profile Send private message
amnuts
Site Admin


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

PostPosted: Fri May 11, 2007 7:44 am    Post subject: Reply with quote

Still around, yeah, but unfortunately not usually able to answer posts the same day that they are posted (or even the next, often enough!)

If I understand your post correctly (which I may not, so correct me if I'm wrong), you want to have an image with a cropping area of 3:4 and it not go below the minimum of 120x160 pixels in size. I'm assuming that you don't want the user to be able to change the proportions of the cropping area, but you want them to be able to change the size (relative to the proportions). Once that's done, you'll handle making the image the correct size if they crop larger.

OK, so assuming all of that.... you'll want to use something like this:

Code:
require('class.cropinterface.php');
$ci = new CropInterface;
if ($_GET['file']) {
    // do whatever you need to do with the image.
    // but as an example...
    $ci->loadImage($_GET['file']);
    $ci->cropToDimensions($_GET['sx'], $_GET['sy'], $_GET['ex'], $_GET['ey']);
    $ci->showImage('jpg', 90);
    exit;
} else {
    $ci->setCropAllowResize(true);
    $ci->setCropTypeDefault(ccRESIZEPROP);
    $ci->setCropTypeAllowChange(false);
    $ci->setCropSizeDefault('3:4');
    $ci->setCropMinSize(120, 160);
    $ci->loadInterface('/path/to/the/image.jpg');
    // if you want to allow large images to be uploaded, this will
    // help limit their appearance in the crop interface...  just
    // set your maximum display size and uncomment the line.
    // $ci->setMaxDisplaySize('300x400');
    // this needs to be after any other html you may have
    $ci->loadJavascript();
}


Naturally you'll want to fit that in to your own code somehow, the the main parts are there:

$ci->setCropAllowResize(true);
Allows people to resize the cropping area.

$ci->setCropTypeDefault(ccRESIZEPROP);
Sets the box to resize proportionally.

$ci->setCropTypeAllowChange(false);
Doesn't allow them to change between any dimension and proportional.

$ci->setCropSizeDefault('3:4');
Sets the cropping area to be 3:4 of whatever the initial image is.

$ci->setCropMinSize(120, 160);
Doesn't allow cropping area resizing below 120x160 pixels.

HTH

Andy
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