Piwigo.org

You are not logged in. (Register / Login)

Announcement

Post a reply

Write your message and submit

Click in the dark area of the image to send your post.

Go back

Topic review (newest first)

P@t
2012-02-09 21:21:17

Of course, it's better :-)

rvelices
2012-02-09 18:09:03

isn't it better to have just

Code:

function derivative($type, $img)
{
  return new DerivativeImage($type, $img);
}

you could use any member of DerivativeImage, eventually store the object and reuse it (to avoid recreating the same thing N times)

P@t
2012-02-09 14:07:33

Is it possible to add function to retrieve derivative size in PwgTemplateAdapter class?

Code:

  function derivative_get_size($type, $img)
  {
    $src_image = new DerivativeImage($type, $img);
    return $src_image->get_size();
  }

  function derivative_get_size_htm($type, $img)
  {
    $src_image = new DerivativeImage($type, $img);
    return $src_image->get_size_htm();
  }
rvelices
2012-02-09 08:51:09

P@t wrote:

I think we should remove the test and return the bigger image as possible with given parameters...

ok

P@t
2012-02-08 20:39:03

I think we should remove the test and return the bigger image as possible with given parameters...

rvelices
2012-02-08 19:39:59

P@t wrote:

rvelices wrote:

{define_derivative height=100 width=9999} -> all images will have the same height
{define_derivative height=100 width=512 crop=true min_height=100 min_width=10 } -> all images will have the same height; width will be no larger than 512. If the width was larger than 512 (extreme panorama for example), the image will be cropped so that the resulting size will be exaclty 512x100

In GThumb+, I need fixed height for thumbnails... but this does not work... I get a "Too big" error.

because as said on the forum, I added the following test in i.php

Code:

    $greatest = ImageStdParams::get_by_type(IMG_XXLARGE);
    if ($params->max_width() > $greatest->max_width() || $params->max_height() > $greatest->max_height())
    {
      ierror('Too big', 403);
    }

maybe :
a. we remove the test ?
b. change || to && ?
c. or modify ImageStdParams::get_custom and make sure w/h is no larger than xxlarge ?

P@t
2012-02-08 17:36:21

rvelices wrote:

{define_derivative height=100 width=9999} -> all images will have the same height
{define_derivative height=100 width=512 crop=true min_height=100 min_width=10 } -> all images will have the same height; width will be no larger than 512. If the width was larger than 512 (extreme panorama for example), the image will be cropped so that the resulting size will be exaclty 512x100

In GThumb+, I need fixed height for thumbnails... but this does not work... I get a "Too big" error.

flop25
2012-02-04 16:58:33

rvelices wrote:

flop25 wrote:

what do the recent commits change in that practical case ?

nothing really. I'm thinking about it, but honestly I'm against it because I think the way it is now is more powerful and optimized.

ok I understand, you said -not directly- that you didn't want to change the way the url is display in tpl.
I just would like you explain to me how to set proprely the derivative parameters by php, plz. In order to understand and to explain later, and for updating themes too
thx

rvelices
2012-02-03 15:58:01

flop25 wrote:

what do the recent commits change in that practical case ?

nothing really. I'm thinking about it, but honestly I'm against it because I think the way it is now is more powerful and optimized.

flop25
2012-02-03 13:48:05

hello again ^^
what do the recent commits change in that practical case ?

flop25
2012-01-30 17:12:04

rvelices wrote:

ok. it's getting better. you are making a theme.
I think because you are in a theme, there should be no need for such thing as local_head, prefilter or events ....

In order to be compatible with most of extension and to have a minimal maintenance between piwigo upgrades, it's better to do not have tpl files over-reading/writing the default ones.

rvelices wrote:

can you tell me what the algo would be to compute $conf_thumbnail_width[$i] ?

that's just the default config of the theme : here in that example 3 sizes so there is just $conf_thumbnail_width[1/2/3]

rvelices wrote:

while I wait for your algo, you could use:
{define_derivative}

The method that I thought and that you might think too, is to set {define_derivative  name='One' width=$conf_thumbnail_width[1]... with conf_thumbnail_width previously assigned.
Then
{foreach from=$thumbnails item=thumbnail name=thumbnail _loop}
{if $smarty.foreach.foo.index  == 1}<img src="{$pwg->derivative_url($One, $thumbnail.src_image)}">
...
But I do prefer a full php solution

btw that's great that we can use min_ parameters

rvelices
2012-01-30 16:55:32

ok. it's getting better. you are making a theme.
I think because you are in a theme, there should be no need for such thing as local_head, prefilter or events ....

can you tell me what the algo would be to compute $conf_thumbnail_width[$i] ?

while I wait for your algo, you could use:

{define_derivative height=100 width=9999} -> all images will have the same height
{define_derivative height=100 width=512 crop=true min_height=100 min_width=10 } -> all images will have the same height; width will be no larger than 512. If the width was larger than 512 (extreme panorama for example), the image will be cropped so that the resulting size will be exaclty 512x100

flop25
2012-01-30 16:15:43

ok no problem
sry for disturbing you

take http://fthrwght.com/autofocus/plusdemo/ => the sizes are known, just the height can be set by the user Let's say 3 sizes to alternate.
Before multi size :
-dynamic css via localhead.tpl due to the height
-in themeconf.inc.php a trigger on loc_end_index_thumbnails, with
  $i=1;
  foreach ($tpl_thumbnails_var as $tplvar)
  {
$tplvar['TN_SRC']=PHPWG_THEMES_PATH."stripped_black_bloc/library/phpthumb/phpThumb.php?src=../../../../".$tplvar['FILE_PATH']."&w=".$conf_thumbnail_width[$i];
....

no prefilter

With multi size, as it's currently implemented :
-dynamic css via localhead.tpl
-in themeconf.inc.php a prefilter on loc_end_index_thumbnails, with substr "{$pwg->derivative_url($derivative_params, $thumbnail.src_image)}" by "{$thumbnails.my_derivative_url}
-in themeconf.inc.php a trigger on loc_end_index_thumbnails, with
  $i=1;
  foreach ($tpl_thumbnails_var as $tplvar)
  {
          $current_derivative = new DerivativeImage($derivativeParams[$i], $tplvar['TN_SRC']);
          $tplvar['my_derivative_url']=$current_derivative->get_url();
...
but I don't know how to set $derivativeParams[$i]

Do you think that's ok ?

rvelices
2012-01-30 15:59:35

flop25, I really don't get what the problem is with the current implementation.
note that there is an event for generating derivative_params and a plugin might be able to change it.

What exactly do you want to do ?

flop25
2012-01-30 14:56:31

rvelices wrote:

flop25 wrote:

So my final question is : is-it possible to change the way to think ?

well this is what we did with the derivatives :)

^^ I thought of that just after posting

rvelices wrote:

Note that we use the derivative_params to set the css ... so you'll probably need to change your tpl anyway.

well not in fact because the local_head is very usefull to add tpl which don't need te be in a specific file : so i think the designer will put their {define_derivative} there, as the same way I've already put dynamic css in.
And I've thought about the problem of cyclical/random/etc sizes : the best way -for me, maybe you have a better idea- is to substr "{$pwg->derivative_url($derivative_params, $thumbnail.src_image)}" by "{$thumbnails.my_derivative_url}", and use the php function which render derivative urls to assign my_derivative_url : derivative_url() is a function from the template class and I don't know how to handle that "outside of a the box"..
is it $current_derivative = new DerivativeImage($derivativeParams_01, $tplvar['TN_SRC']); and then $current_derivative->get_url()?
creating multiple instances of DerivativeImage will not cause perf issue ?

Board footer

Powered by FluxBB

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