[fixed]: problem with resize tool. - Page 2 [fixed]: problem with resize tool. - Page 2
 

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Main Menu

[fixed]: problem with resize tool.

Started by allisonv7, February 24, 2004, 10:32:17 PM

Previous topic - Next topic

0 Members and 4 Guests are viewing this topic.

Casper

Hi Allison,

for the moment, you will have to keep the normal and original, but at least the original is now a smaller file.

For now, don't use the delete original after recreating the normal, or the same thing will happen again.  I hope we can sort this out, so you can delete them later.
It has been a long time now since I did my little bit here, and have done no coding or any other such stuff since. I'm back to being a noob here

Casper

@gaugau/tarique,

There appears to be a conflict with this piece of code in displayimage.php, and the use of the re-size tool, in certain circumstances;
if ($CONFIG['make_intermediate'] && max($CURRENT_PIC_DATA['pwidth'], $CURRENT_PIC_DATA['pheight']) > $CONFIG['picture_width']) {
        $picture_url = get_pic_url($CURRENT_PIC_DATA, 'normal');
    } else {
        $picture_url = get_pic_url($CURRENT_PIC_DATA, 'fullsize');
    }


If the config setting for max size is set at 'height', and the pics are in landscape mode, when the re-size utility is used to delete the original, the display fails.

I think this is because the code is only looking at the pic width '> $CONFIG['picture_width'])', but comparing it against the maximum height.  As the pic is in landscape, this will be greater, so coppermine is looking for a 'normal_' pic, which is not there.

I have spent some time trying to change this code, without success   :?
It has been a long time now since I did my little bit here, and have done no coding or any other such stuff since. I'm back to being a noob here

FreeMail

Quote from: "casper"I have a theory, which I need you all to answer a question.

Those who have this happen, what is your setting in config, for
QuoteUse dimension ( width or height or Max aspect for thumbnail )*


mine is set to 'Height'

Casper

It has been a long time now since I did my little bit here, and have done no coding or any other such stuff since. I'm back to being a noob here

Joachim Müller


Tarique Sani

Replace this line if ($CONFIG['make_intermediate'] && max($CURRENT_PIC_DATA['pwidth'], $CURRENT_PIC_DATA['pheight']) > $CONFIG['picture_width']) {

With
   if($CONFIG['thumb_use']=='ht' && $CURRENT_PIC_DATA['pheight'] > $CONFIG['picture_width'] ){ // The wierd comparision is because only picture_width is stored
      $condition = true;
    }elseif($CONFIG['thumb_use']=='wd' && $CURRENT_PIC_DATA['pwidth'] > $CONFIG['picture_width']){    
      $condition = true;
    }elseif($CONFIG['thumb_use']=='any' && max($CURRENT_PIC_DATA['pwidth'], $CURRENT_PIC_DATA['pheight']) > $CONFIG['picture_width']){    
      $condition = true;
    }else{    
     $condition = false;    
    }

               
    if ($CONFIG['make_intermediate'] && $condition ) {


Let me know if it is working for you in all combinations and I will commit it to CVS
SANIsoft PHP applications for E Biz

Casper

Hi Tarique,

your code works well for me, with the config set both ways, and with pics in both landscape and portrait, thank you very much.  :wink:
It has been a long time now since I did my little bit here, and have done no coding or any other such stuff since. I'm back to being a noob here

Tarique Sani

SANIsoft PHP applications for E Biz

FreeMail

Quote from: "tarique"Replace this line if ($CONFIG['make_intermediate'] && max($CURRENT_PIC_DATA['pwidth'], $CURRENT_PIC_DATA['pheight']) > $CONFIG['picture_width']) {

With
   if($CONFIG['thumb_use']=='ht' && $CURRENT_PIC_DATA['pheight'] > $CONFIG['picture_width'] ){ // The wierd comparision is because only picture_width is stored
      $condition = true;
    }elseif($CONFIG['thumb_use']=='wd' && $CURRENT_PIC_DATA['pwidth'] > $CONFIG['picture_width']){    
      $condition = true;
    }elseif($CONFIG['thumb_use']=='any' && max($CURRENT_PIC_DATA['pwidth'], $CURRENT_PIC_DATA['pheight']) > $CONFIG['picture_width']){    
      $condition = true;
    }else{    
     $condition = false;    
    }

               
    if ($CONFIG['make_intermediate'] && $condition ) {


Let me know if it is working for you in all combinations and I will commit it to CVS


just to confirm, is this for 'displayimage.php'?

tia!

Nibbler

Yes, seeing as that is the only file in coppermine which actually has the line you need to replace.

FreeMail


tabassman

i wanted to get rid of my huge 1meg pics but when i went to resize>>delete originals, it renamed all the pics correctly (ie got rid of the normal_) but for the link to the pic it didnt modify where most of them point to.  most still point to the "normal_" version.  none of my galleries are or ever were under the userpics folder either.  The only ones it modified the image path for were the ones it said it couldnt find. For instance "The file albums/wop_party/normal_100_1328.jpg was not found" that pic works.  but most of them said "The file albums/wop_party/normal_100_1306.jpg was successfully used as main picture!" which left the img src as "normal_" and thus leads to broken images.

my link: http://66.90.73.60/~vicphoto/gallery/

I dont want to go to delete originals again, because i fear that it will delete the files without "normal_" because it will mistake them as the originals.

i confused.

tabassman

it might have something to do with the size of the picture.  all the vertical pictures work fine.  but the horizontal ones do not.  here are my settings for sizes:

quality:  80
max dim of thumbs:  100
use dim:  height
intermediate?:  yes
max width or height of intermediate:  540
max size: 1424 (kB)
max height or width: 2180

i am even more confused now.  where are the paths to the pictures stored?  i analyzed the displayimage.php file to no resolve.

Casper

It has been a long time now since I did my little bit here, and have done no coding or any other such stuff since. I'm back to being a noob here

tabassman

thanks.  i saw that the guy who started the thread was having other problems so i skipped that thread.

Casper

That's a shame, because if you had read through the thread, you would see this comes into it, and the fix is there.  Look for the first post by tarique in the thread, on page 2.
So how did you solve it?
It has been a long time now since I did my little bit here, and have done no coding or any other such stuff since. I'm back to being a noob here

tabassman

Quote from: "casper"That's a shame, because if you had read through the thread, you would see this comes into it, and the fix is there.  Look for the first post by tarique in the thread, on page 2.
So how did you solve it?

i meant i initially skipped the thread when i was first trying to solve it.  having it remake the normals and then deleting the originals worked just fine.  HOWEVER, slideshow still references the normal_ files.  where are the references to these img src's stored?

tabassman

here is some code in the slideshow include php.

foreach ($pic_data as $picture) {
    if ($CONFIG['make_intermediate'] && max($picture['pwidth'], $picture['pheight']) > $CONFIG['picture_width']) {
        $picture_url = get_pic_url($picture, 'normal');
    } else {
        $picture_url = get_pic_url($picture, 'fullsize');
    }


this makes it so that the normal version is used when the picture width or height is greater than the width defined in config, right?

well, my max width is actually a height.  540.  so landscape pictures never fall into this category correctly.

how do i make it so that it doesnt decide based upon height and width and all that, but instead decides based upon whether or not i have deleted the normal_ files using resize????

thanks for your help, you guys kick ass.

EDIT:  thought about it.  should i use min() instead.  that way 540 would always defeat 540 in the > test and when i have the originals intact they would obviously be > as well (even the min value).  let me know if this is good thinking.  i just did it and it *seems* to work.

Casper

Apologies for earlier misunderstanding.
You have found a bit that was missed when this was first sorted.

I'm not sure if your solution is the best way, or just carrying out tariques code change in slideshow.php.  
Hopefully he will read this and let us know.

Just to re-cap, tariques code change was;
Replace this line if ($CONFIG['make_intermediate'] && max($CURRENT_PIC_DATA['pwidth'], $CURRENT_PIC_DATA['pheight']) > $CONFIG['picture_width']) {  

With


if($CONFIG['thumb_use']=='ht' && $CURRENT_PIC_DATA['pheight'] > $CONFIG['picture_width'] ){ // The wierd comparision is because only picture_width is stored
      $condition = true;
    }elseif($CONFIG['thumb_use']=='wd' && $CURRENT_PIC_DATA['pwidth'] > $CONFIG['picture_width']){    
      $condition = true;
    }elseif($CONFIG['thumb_use']=='any' && max($CURRENT_PIC_DATA['pwidth'], $CURRENT_PIC_DATA['pheight']) > $CONFIG['picture_width']){    
      $condition = true;
    }else{    
     $condition = false;      
    }

             
    if ($CONFIG['make_intermediate'] && $condition ) {  



Merged with thread dealing with this problem.
It has been a long time now since I did my little bit here, and have done no coding or any other such stuff since. I'm back to being a noob here

tabassman

i hadnt noticed that both pieces of code were similar.  i replaced mine with tariques and it worked fine.