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.


If you can help Id b'willing to name my first born after you

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


Joined: 30 May 2006
Posts: 9

PostPosted: Thu Jun 01, 2006 11:39 am    Post subject: If you can help Id b'willing to name my first born after you Reply with quote

Seriously…if I didn’t already have 3 children…I would. You are a brilliant man and I want you desperately! Here is my situation. I am a wanna be web designer who has found herself in over her head with my current job. My employer (a lovely generous woman) works with schools doing fundraising work where she puts children’s art onto products like t-shirts-mugs etc. She does not make a lot of money doing this but she feels good about it. Anyway, she would like to put on her website Wink www.artwarebyyou.com (which I designed) a feature where people can upload their children’s artwork instead of always mailing it in. They can also use photographs. They would need the crop feature because certain products can only take square images. In doing some research I came across your site and tried to remotely understand how to implement this into her site. I am working with FrontPage and I am very unfamiliar with PHP. I am willing to pay the fee, but could use a little hand holding with incorporating this. Can this be integrated with shopping cart software? Am I allowed to use this wonderful information for this purpose? Am I completely hopeless and barking up the wrong tree? Are you single? He he…Please respond.
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 Jun 02, 2006 8:20 am    Post subject: Reply with quote

Now that was funny!! Very Happy

Welcome (in a very big way!) to the board.

The first thing to do is make sure that the web server you're putting the site on supports PHP, and that it has the GD library. The easiest way of doing this (short of asking the system admin and waiting for them to respond) is to put up a PHP file (call it 'info.php' for the sake of argument) with this line in it (and only this line in it):

PHP:
<?php phpinfo() ; ?>


Then go to that page in a browser and see if it spits back anything.

If you can indeed use PHP then what you need (at the bare minimum) is a page that has a form to upload a file, a script to process that as needs be (resize, save in a particular directory, etc.) and then display the cropping interface and process the image again once it's been submitted.

A really simple intro to file uploading and handling can be found on the php.net website:

http://uk.php.net/manual/en/features.file-upload.php

It has a very basic example of a file upload form, which looks something like this:

Code:
<form enctype="multipart/form-data" action="process_upload.php" method="POST">
    Send this file: <input name="userfile" type="file" />
    <input type="submit" value="Send File" />
</form>


and then some PHP to process it:

PHP:
<?php

$uploaddir 
'/var/www/uploads/';
$uploadfile $uploaddir basename($_FILES['userfile']['name']) ;

echo 
'<pre>';
if (
move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) {
   echo 
'File is valid, and was successfully uploaded.';
} else {
   echo 
'Possible file upload attack!';
}

echo 
'Here is some more debugging info:';
print_r($_FILES) ;
echo 
'</pre>';

?>


It's in the above stage that you would pre-process the image for cropping (after you've moved it), such as making sure it's of a valid size or rotating it, or whatever you would need to do (if anything!). Once moved you could instantiate (make an instance of) the cropping interface and then display it.

So first check to see you can use PHP, and if so break down the thing into nice small chunks. First see if you can get a file uploaded. then see if you can get the cropping interface to work based on the example file supplied on this site. If all goes well then you should tyr to merge the two together.

Feel free to post up requests or questions. Unless they're specifically about the crop canvas class then it's probably best you post on the 'php questions' board.

Regards,

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