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.


Image Resizing

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


Joined: 29 Nov 2004
Posts: 2
Location: Fort Lauderdale, Florida, USA

PostPosted: Tue Dec 07, 2004 7:04 pm    Post subject: Image Resizing Reply with quote

Hello Andy,

Thanks for all the help. Your file upload tips worked great and I just read another thread for the ?setUrlParameter? function and it also worked great.

But I am still having problems with resizing, I did manage to get the cropping area working (135 x 135) by changing the ?setCropDefaultSize? function, but if I try to change it to (100 x 150) I cannot get it to work.

I have looked at your ?Dropshadow? program, but it does not seem to be what I need.

I will try to explain in detail what I am trying to say.

I would like to be able to drag the crop box over any part of any size image (i.e.: 325 x 225) with out resizing the original image before hand, then be able to adjust the crop area proportionally starting with (100 x 150) and end up with the cropped section (100 x 150).

At this point it only seem to crop proportionally or by percentage of the image size.

If this is possible, please let me know.

Thank for all the help.

Jeff
Back to top
View user's profile Send private message
amnuts
Site Admin


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

PostPosted: Thu Dec 09, 2004 6:36 am    Post subject: Reply with quote

Hi Jeff,

From what I understand; you want to have a crop size which is 100x150. You want to be able to expand and contract that crop size, but always proportional to the 100x150 and never less than 100x150. Let me know if that's incorrect. Assuming it's not...

When you set a default crop size it should then expand and contract proportionally to that size. See this link for an example:

http://php.amnuts.com/demos/crop-canvas/interactive2.php

I did that by using the code:

PHP:
<?php

    
require_once('class.cropinterface.php');
    
$ci =& new cropInterface();
    
$ci->setCropDefaultSize(50200);

?>


To set a minimum size, use setCropMinSize. At this point you'd probably also want to turn off the resizing type options and set it to proportional only resizing. To turn it off, use the setResizing method, and to set cropping to proportional only, you'll have to make a small tweak to the code. For that, see my post here:

http://php.amnuts.com/forums/viewtopic.php?t=184

Okay, so your instantiation ends up looking something like:

PHP:
<?php

    
require_once('class.cropinterface.php');
    
$ci =& new cropInterface();
    
$ci->setCropDefaultSize(100150);
    
$ci->setCropMinSize(100150);
    
$ci->setResizing(false);

?>


Andy
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger MSN Messenger
reethaar
Newbie


Joined: 10 May 2005
Posts: 2
Location: holland

PostPosted: Tue May 10, 2005 4:42 am    Post subject: think the question is Reply with quote

hi there

think the question here is.... what i am also looking for
the awnser posted here is only part of what i am try too accomplish

but how do i get the corp, afther selecting the area, to resize the croped result back to the 150 X 100 size to save it

so i want to select a crop area proportionaly, but always resize the resulting crop (proportional) back to the 100x150 size

and then save it, prefrebly straight in to a blob in my Mysql database
Back to top
View user's profile Send private message Send e-mail
amnuts
Site Admin


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

PostPosted: Mon May 16, 2005 9:21 am    Post subject: Reply with quote

Hi, and welcome to the board.

Okay, I see what you're after. I have done something similar with the combination of the cropping classes and the thumbnail (dropshadow) class. Something along these lines:

PHP:
<?php

    
include('class.cropinterface.php');
    
$ci =& new cropInterface();

    if (!isset(
$_GET['file'])) {
        
$ci->loadInterface('myfile.jpg');
        
$ci->loadJavaScript();
    } else {
        
$ci->loadImage($_GET['file']);
        
$ci->cropToDimensions($_GET['sx'], $_GET['sy'], $_GET['ex'], $_GET['ey']);
        include(
'class.dropshadow.php');
        
$ds =& new dropShadow();
        
$ds->setShadowPath('./');
        
$ds->loadImage($_GET['file']);
        
$ds->resizeToSize(150100);
        
$ds->saveFinal($_GET['file'], 'jpg'80);
    }

?>


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