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.


crop and shadow: poor quality output
Goto page Previous  1, 2
 
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: Mon Jun 14, 2004 6:11 am    Post subject: Reply with quote

Hmm.. That code suggest that you have debugging for crop canvas turned off (by the 'false' parameter). Make it true and see what the results are. Also, try flushing the images like I mentioned before to see if that helps. (and also don't forget to unlink the temp file when you're done with it.)

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


Joined: 10 Jun 2004
Posts: 12
Location: Melbourne, Australia

PostPosted: Wed Jun 16, 2004 3:30 am    Post subject: Reply with quote

i managed to find the problem.. all i had to do was comment out some lines to isolate the problem lines..

its pretty much working now as i had expected.

for those of you playing at home, here is my final script with the additions mentioned before:

PHP:
<?php

// address style: script.php?input=pic.jpg&shadow=1&bg=#AA&size=125&area=topright

require_once "thumbnail/class.dropshadow.php"
require 
'thumbnail/class.cropcanvas.php';
$cc = new canvasCrop(FALSE);
$ds = new dropShadow(FALSE); 
$ds->setShadowPath('./thumbnail/'); 

$strVals = array( 
        
'top' => ccTOP,  
        
'topleft' => ccTOPLEFT,  
        
'topright' => ccTOPRIGHT
        
'left' => ccLEFT
        
'center' => ccCENTER
        
'right' => ccRIGHT
        
'bottomleft' => ccBOTTOMLEFT
        
'bottom' => ccBOTTOM
        
'bottomright' => ccBOTTOMRIGHT
    );

$input  "/home/user/public_html/{$_GET['input']}"
$tempFile '/home/user/public_html/tmp/' uniqid('') . '.png'

$ds->loadImage($input); 
$sizes getimagesize($input); 
if (
$sizes[0] > $sizes[1]) { 
    
$ds->resizeToSize(0210); 
} else { 
    
$ds->resizeToSize(2100); 
}
$ds->saveFinal($tempFile'png'); 

$cc->loadImage($tempFile); 
$cc->cropToSize('200''200'$strVals[$_GET['area']]);
$cc->saveImage($tempFile'png');

$ds->flushImages(); 
$ds->loadImage($tempFile); 
unlink($tempFile);
$ds->resizeToSize($_GET['size'], $_GET['size']);
if (
$_GET['shadow'] == 1) { 
    
$ds->applyShadow($_GET['bg']); 
    
$ds->showShadow('jpg'); 
} else { 
    
$ds->showFinal('jpg'90);         
}
?>
Back to top
View user's profile Send private message
guildford
Newbie


Joined: 10 Jun 2004
Posts: 12
Location: Melbourne, Australia

PostPosted: Wed Jun 16, 2004 3:35 am    Post subject: Reply with quote

sorry, perfectionist at work, but..

the only time i would use the &area= would be for my very large images to specify which area to crop. if this is left blank, the default of TOPLEFT is made. is there a way to change the default top TOP only

if it involves changing the class, dont worry, just a nitty gritty question..

this'll be my final post, i swear..
Back to top
View user's profile Send private message
amnuts
Site Admin


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

PostPosted: Wed Jun 16, 2004 4:48 am    Post subject: Reply with quote

guildford wrote:
sorry, perfectionist at work, but..


No worries... totally understand!

guildford wrote:
the only time i would use the &area= would be for my very large images to specify which area to crop. if this is left blank, the default of TOPLEFT is made. is there a way to change the default top TOP only

if it involves changing the class, dont worry, just a nitty gritty question..


No class changes required, just change the appropriate line to look like this:

PHP:
<?php $cc->cropToSize('200''200', (isset($_GET['area']) && $_GET['area'] != '' $strVals[$_GET['area']] : ccTOP)); ?>


guildford wrote:
this'll be my final post, i swear..


No probs! If you have any more, post them up (either to this thread or start a new one). Of course, if you appreciate the classes and help then feel free to donate something. Wink

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
Goto page Previous  1, 2
Page 2 of 2

 
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