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.


SetMaxDisplaySize doesn't always work correctly

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


Joined: 03 Jan 2007
Posts: 1

PostPosted: Tue Jan 09, 2007 4:35 pm    Post subject: SetMaxDisplaySize doesn't always work correctly Reply with quote

Hi!

First I would like to say thanks for your great work! This script is exactly what I have been looking for.
I'm planning to use it on a commercial website and I will gladly pay for it
(if I figure out how to use PayPal Wink ). I'll send you an email in the near future with further details.

But unfortunately there seems to be an issue with SetMaxDisplaySize. I set it to 600x600 and if I use your script with an image, which is higher than wide and bigger than SetMaxDisplaySize (e.g. 900x1200) everything is fine, the area for CropImage is scaled to ?x600 (where ? is <600).
But if I use it with an image, which is wider than high and bigger than SetMaxDisplaySize (e.g. 1200x900), the area for CropImage is scaled to ?x600 (where ? is >600). But this is not correct, it should be scaled to 600x? (where ? is <600).
Any help is really appreciated!

Thanks and greetings from Germany
Tom
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 16, 2007 10:46 am    Post subject: Reply with quote

Hi, and welcome to the board!

I see what you mean... Damn, I thought I had tested it with both a landscape and portrait image. Confused I guess I'm just missing a check for which dimension is bigger... I'll try to investigate some time soon.

In the meantime, if you want to play around with things then check out the loadInterface method. It'll be around this chunk of code that you want to tweak:

PHP:
<?php if (!empty($this->crop['max-display'])
&& (
$this->img['sizes'][0] > $this->crop['max-display'][1]
    || 
$this->img['sizes'][1] > $this->crop['max-display'][2])) {
if (
$this->crop['max-display'][1] > $this->crop['max-display'][2]) {
    
$this->crop['max-display'][2] = round($this->img['sizes'][1] / ($this->img['sizes'][0] / $this->crop['max-display'][1]));
} else {
    
$this->crop['max-display'][1] = round(($this->crop['max-display'][2] / $this->img['sizes'][1]) * $this->img['sizes'][0]);
}
$this->crop['max-display'][0] = $this->crop['max-display'][1] . 'x' $this->crop['max-display'][2];
$this->crop['max-display'][3] = $this->img['sizes'][0] / $this->crop['max-display'][1];
$this->img['sizes'][0] = $this->crop['max-display'][1];
$this->img['sizes'][1] = $this->crop['max-display'][2];
} else {
$this->crop['max-display'] = array();
?>


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


Joined: 01 Jul 2007
Posts: 2

PostPosted: Sun Jul 01, 2007 6:59 pm    Post subject: Reply with quote

Hi There!
I have the same problem, but i can't imagine which operators to swap, so the right image resolution will appear.....

But I've also another problem..
The line: Crop size: 292 / 158

if the function: $ci->setMaxDisplaySize('300x300');
is enabled, the crop size value refers to the reduced image size, and not to the original image size... e.g.:
i've an image 1024x860

if i'll load it with crop canvas, the size is reduced to 400x300
that's no problem at all...
but if i select half of the image, the Crop size labels: 200 / 150

the croped image is 512x430... ok, but is it possible, that the crop size label refers to the original image size? so if i select half of the image:
Crop size: 512x430, instead of 200 / 150

i hope you understood what i wanted to say...
Back to top
View user's profile Send private message
w2felix
Newbie


Joined: 01 Jul 2007
Posts: 2

PostPosted: Mon Jul 23, 2007 12:06 pm    Post subject: Reply with quote

sorry, does anybody know a solution for my problem?
Back to top
View user's profile Send private message
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