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.


How to save the image after croping?

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


Joined: 26 Jan 2004
Posts: 2

PostPosted: Mon Jan 26, 2004 2:49 am    Post subject: How to save the image after croping? Reply with quote

hi,

I am newbie to php. the script is very useful to me. now i want to save the croped image with the same name of the image "mypicture.jpg" in a seperate folder. any help?

thanks in advance
raj
Back to top
View user's profile Send private message
amnuts
Site Admin


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

PostPosted: Mon Jan 26, 2004 9:15 am    Post subject: Reply with quote

Hi Raj, and welcome to the board!

It's really easy to save a file once it's been cropped. Just using the 'saveImage' function:

function saveImage($filename, $quality = 100)

Such as:

$cc->saveImage('/home/raj/pictures/mypicture.jpg', 80);

The '80' is the image quality. You can put it anything between 0 and 100 (inclusive), or if you don't supply it then it defaults to 100 (bst quality but biggest file size). If you are saving as a PNG then you don't need to supply a quality.

Hope that helps!

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


Joined: 26 Jan 2004
Posts: 2

PostPosted: Tue Jan 27, 2004 4:15 am    Post subject: I got how to save now thanks but.... Reply with quote

hi guys,

I have a dating website. people used to upload their photos. what i want is i have to screen all the uploaded images under foler ("upload") and crop them one bye one and save them in a seperate folder called "thumb".

Any help.

thanks in advance
rwave
Back to top
View user's profile Send private message
amnuts
Site Admin


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

PostPosted: Tue Jan 27, 2004 4:40 am    Post subject: Reply with quote

Hi,

This should be a fairly easy task. You could use the crop interface to make it easier on yourself, too. I'll not do all the programming for you here, but if you follow the example and plug in the bits of code you need, then you should be able to get something up and running fairly quickly.

PHP:
<?php <?php

    
require_once 'class.cropinterface.php';
    
$ci = new cropInterface();
    
// you can set various crop-interface parameters here, such as
    // default crop size, resizing options, etc.
    
    
if ($_GET['file'])
    {
        
$ci->loadImage($_GET['file']);
        
$ci->cropToDimensions($_GET['sx'], $_GET['sy'], $_GET['ex'], $_GET['ey']);
        
$ci->saveImage("/my/thumb/{$_GET['file']}"80);
    }

?>

<html>

<head>
    <style type="text/css">
        body, td, p
        {
            font-family: Tahoma, Verdana, Arial, Helvetica, sans-serif;
            font-size: 10px;
        }
        
        #submit
        {
            font-size: 10px;
            font-family: "MS Sans Serif", Geneva, sans-serif;
            height: 23px;
            background-color: #D4D0C8;
            border: 0px;
            padding: 3px,5px,3px,5px;
            width: 100%;
        }
    </style>
</head>
<body>

    <?php

        
if ($_GET['file']) {
            echo 
'The image has now been saved.';
        } else {
            if (!isset(
$_POST['picture'])) {
                
// put a form here that reads from your uploads directory
                // and puts the filenames into a drop-down list
            
} else {
                
$ci->loadInterface($_POST['picture']);
                
$ci->loadJavaScript();
            }
        }

    
?>

</body>
</html> ?>


You mentioned that you want to save a thumbnail... If you think you may need to resize an image before cropping it, then check out the dropshadow class, because this provides a lot of image resizing options.

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