•  » Engine
  •  » how does the Center Of Interest works?

#1 2012-04-02 14:13:08

plg
Piwigo Team
Nantes, France, Europe
2002-04-05
14094

how does the Center Of Interest works?

Hi rvelices,

I just gave a look at how the coi is stored in the database:

Code:

mysql> select coi from piwigo_images where coi is not null;
+------+
| coi  |
+------+
| mbsj |
| hbul |
| garh |
| kcqg |
| lazk |
| fbtl |
+------+
6 rows in set (0.00 sec)

can you explain what it means and how it's used in the code?

Offline

 

#2 2012-04-02 14:45:31

rvelices
Former Piwigo Team
2005-12-29
1960

Re: how does the Center Of Interest works?

4 letters: left, top, right, bottom of center of interest as a fraction encoded as a = 0 z = 1

Code:

function char_to_fraction($c)
{
  return (ord($c) - ord('a'))/25;
}

function fraction_to_char($f)
{
  return ord('a') + round($f*25);
}

used in class ImageRect crop_h() and crop_v() (derivative_params.inc.php)

Offline

 

#3 2012-04-02 15:58:46

plg
Piwigo Team
Nantes, France, Europe
2002-04-05
14094

Re: how does the Center Of Interest works?

OK, understood, very "compressed" way to store this information :-)

Thank you for explanation.

Offline

 

#4 2012-04-03 21:25:46

Zaphod
Former Piwigo Team
2006-11-13
441

Re: how does the Center Of Interest works?

I never saw this new option (and I had no clue of what is was about before reading a post in the french forums), and that's just awesome.

Offline

 

#5 2012-04-03 21:39:26

plg
Piwigo Team
Nantes, France, Europe
2002-04-05
14094

Re: how does the Center Of Interest works?

Zaphod wrote:

[...] that's just awesome.

I agree. It is not a very easy concept but highly powerful and we can see the result "live" on all "cropped" sizes.

Offline

 

#6 2012-04-03 21:56:08

Zaphod
Former Piwigo Team
2006-11-13
441

Re: how does the Center Of Interest works?

That's what's missing in most cases when you choose to use square thumbs, for example.
For reasonably small galleries, that's very useful.

Offline

 
  •  » Engine
  •  » how does the Center Of Interest works?

Board footer

Powered by FluxBB