Piwigo.org

You are not logged in. (Register / Login)

Announcement

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

plg
Piwigo Team
Location: Paris, France, Europe
Registered: 2002-04-05
Posts: 11717
Website

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?


Latest blog post on Piwigo.com: Piwigo 2.5 on Piwigo.com (March 7th, 2013)

Offline

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

rvelices
Piwigo Team
Registered: 2005-12-29
Posts: 1554
Website

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
Location: Paris, France, Europe
Registered: 2002-04-05
Posts: 11717
Website

Re: how does the Center Of Interest works?

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

Thank you for explanation.


Latest blog post on Piwigo.com: Piwigo 2.5 on Piwigo.com (March 7th, 2013)

Offline

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

Zaphod
Piwigo Team
Registered: 2006-11-13
Posts: 439

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
Location: Paris, France, Europe
Registered: 2002-04-05
Posts: 11717
Website

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.


Latest blog post on Piwigo.com: Piwigo 2.5 on Piwigo.com (March 7th, 2013)

Offline

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

Zaphod
Piwigo Team
Registered: 2006-11-13
Posts: 439

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

Board footer

Powered by FluxBB

About this website · Donate · Contact Piwigo project © 2002-2013