Advanced search  

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]

Pages: [1]   Go Down

Author Topic: Saving Thumbs and Resized pics to different directory???  (Read 4963 times)

0 Members and 1 Guest are viewing this topic.

crackers

  • Coppermine newbie
  • Offline Offline
  • Posts: 10
Saving Thumbs and Resized pics to different directory???
« on: January 12, 2011, 07:13:13 pm »

I came across this thread from a long time ago:

http://forum.coppermine-gallery.net/index.php/topic,14581.0.html

Has anyone thought more on this? It would be fantastic to be able to keep years worth of organizing original images without the duplication and clutter of the thumb_* and resize_* files....

Any thoughts?
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15764
Re: Saving Thumbs and Resized pics to different directory???
« Reply #1 on: January 18, 2011, 02:56:09 pm »

Recently a user told me that he uses something like
Code: [Select]
_res/res_
Code: [Select]
_thm/thm_as file prefixes. I haven't tested that, but I think you have to modify the code to create the needed extra directories for you. On some server settings you might get trouble creating those directories which is probably the main reason why Coppermine works how it currently works.
Logged

thomasFRU

  • Contributor
  • Coppermine newbie
  • ***
  • Offline Offline
  • Posts: 14
    • www.uledoc.de
Re: Saving Thumbs and Resized pics to different directory???
« Reply #2 on: February 13, 2011, 11:32:18 pm »

That's right, I do the following changes to the code in
include/picmgmt.inc.php

after
 if ($crop != 1) {
        $destWidth = (int)($srcWidth / $ratio);
        $destHeight = (int)($srcHeight / $ratio);
        $resize_commands = "-geometry ".$destWidth."x".$destHeight;
        $xOffset = 0;
        $yOffset = 0;
    }
add these lines:

     $dest_dir = dirname($dest_file);         //create dir if not exist
    if (! is_dir($dest_dir)) {
      if (! mkdir($dest_dir, 0777, true)) {
          return false;
      }
    }

The prefix for thumbnails and normal pictures I changed to:
thumb/thumb_
normal/normal_

Another change in the code is necessary to prevent browsing the subfolders
when uploading new files. This I do in
searchnew.php
line: 411
if (substr($directory,0,5) != "thumb" && substr($directory,0,6) != "normal") // added do not show  subdir thumb nor subdir normal

Works fine for me when doing slideshow on tv

Thomas
Logged

webcalidad

  • Coppermine newbie
  • Offline Offline
  • Posts: 3
Re: Saving Thumbs and Resized pics to different directory???
« Reply #3 on: March 08, 2011, 10:45:48 pm »

I also want the same feature as you, and I made the changes sugested in the previous message.

But I don't know how to change the prefix as explained:

The prefix for thumbnails and normal pictures I changed to:
thumb/thumb_
normal/normal_


Could someone explain me, where I have to change it.

Logged

thomasFRU

  • Contributor
  • Coppermine newbie
  • ***
  • Offline Offline
  • Posts: 14
    • www.uledoc.de
Re: Saving Thumbs and Resized pics to different directory???
« Reply #4 on: March 09, 2011, 12:41:10 am »

ok, there is another thing you have to do if you have a running
instance of coppermine with existing album-folders and pictures.

The changes I mentioned in the previous message will work
for the future use if you upload and create new pictures.

For the existing ones you have to check every album-folder
and move the thumb_pics to a a new created sub-folder thumb
and the same for normal_pics to a new sub-folder normal.

Do not forget the user-folders (albums/userpics/100...)

I hope this was your problem, otherwise let me know.

Thomas
Logged

webcalidad

  • Coppermine newbie
  • Offline Offline
  • Posts: 3
Re: Saving Thumbs and Resized pics to different directory???
« Reply #5 on: March 09, 2011, 09:32:55 am »

Hi Thomas, thanks for your fast answer.

Doesn't work for me.

I'm creating it now, so my albums aren't important, so I deleted all albums, photos and categories.

And then I made the changes. But for me all images, still are created in the same directory.
------------------------------------
this is my file picmgmt.inc.php

if ($crop != 1) {
        $destWidth = (int)($srcWidth / $ratio);
        $destHeight = (int)($srcHeight / $ratio);
        $resize_commands = "-geometry ".$destWidth."x".$destHeight;
        $xOffset = 0;
        $yOffset = 0;
    }

    $dest_dir = dirname($dest_file);         //create dir if not exist
    if (! is_dir($dest_dir)) {
      if (! mkdir($dest_dir, 0777, true)) {
          return false;
      }
    }
------------------------------------------------
and this is my file searchnew.php

this is the original line 411: if ($CONFIG['display_thumbs_batch_add'] == 1) {


and this is the modified one: if (substr($directory,0,5) != "thumb" && substr($directory,0,6) != "normal") { // added do not show  subdir thumb nor subdir normal
          $return .= <<<EOT
                       <img src="showthumb.php?picfile=$pic_url&amp;size=48" class="thumbnail" border="0" alt="" />
EOT;
        }

as you can see I have put the "{" in the end of the 411 line, as there was before.

....

I also want to tell you that, I want to upload images in the future using the option "Batch", because I need that each album in one separeted folder. The reason I'm using coppermine is just to process photos ( resizing and archive features ), so after it, the images will be displayed in a Joomla site, using a slideshow.

Thanks for your effort and help.

Best regards,

Luciana

--------------------------------------------------------------------------
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15764
Re: Saving Thumbs and Resized pics to different directory???
« Reply #6 on: March 09, 2011, 12:35:59 pm »

The prefix for thumbnails and normal pictures I changed to:
thumb/thumb_
normal/normal_


Could someone explain me, where I have to change it.
Have a look at the config table in Coppermine's MySQL database.
Logged

thomasFRU

  • Contributor
  • Coppermine newbie
  • ***
  • Offline Offline
  • Posts: 14
    • www.uledoc.de
Re: Saving Thumbs and Resized pics to different directory???
« Reply #7 on: March 09, 2011, 09:23:00 pm »

I'm a little bit confused,

which version are you using?
Mine is 1.5.12 (stable)

line 206: if ($CONFIG['display_thumbs_batch_add'] == 1) {
          $return .= <<<EOT
                        <img src="showthumb.php?picfile=$pic_url&amp;size=48" class="thumbnail" border="0" alt="" />
is not the right position, leave this untouched.

The right position is:
line 413: (not 411 as I told  before  (sorry))
      if (count($dir_array) > 0) {
        foreach ($dir_array as $directory) {
            //if (substr($directory,0,1) != ".") // added do not show folders with dots: gaugau 03-11-02
            CPGscandir($dir . $directory . DIRECTORY_SEPARATOR, $expic_array);
        }
    }

change the comment line to:
if (substr($directory,0,5) != "thumb" && substr($directory,0,6) != "normal") // added do not show  subdir thumb nor subdir normal

it should look like:

  if (count($dir_array) > 0) {
        foreach ($dir_array as $directory) {
            if (substr($directory,0,5) != "thumb" && substr($directory,0,6) != "normal") // added do not show  subdir thumb nor subdir normal
            CPGscandir($dir . $directory . DIRECTORY_SEPARATOR, $expic_array);
        }
    }

Greetings Thomas
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15764
Re: Saving Thumbs and Resized pics to different directory???
« Reply #8 on: March 09, 2011, 09:27:26 pm »

Not sure why you posted that code. You have to change the rows 'thumb_pfx', 'normal_pfx' and maybe also 'orig_pfx' in the database.
Logged

thomasFRU

  • Contributor
  • Coppermine newbie
  • ***
  • Offline Offline
  • Posts: 14
    • www.uledoc.de
Re: Saving Thumbs and Resized pics to different directory???
« Reply #9 on: March 10, 2011, 11:55:13 pm »

thats right,

my mail was in relation to the mail before from webcalidad
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15764
Re: Saving Thumbs and Resized pics to different directory???
« Reply #10 on: March 11, 2011, 11:25:38 am »

Sorry, I haven't seen that post :-[
Logged

webcalidad

  • Coppermine newbie
  • Offline Offline
  • Posts: 3
Re: Saving Thumbs and Resized pics to different directory???
« Reply #11 on: March 14, 2011, 11:25:24 am »

Hi guys. Really thanks for your efforts. My Coppermine is 1.5.12 also, but I have made the changes and everything goes on the same way. I have the new prefix 'thumb' and 'normal', but is all over the same folder.

I just want to process images, resizing then and adding the watermark.

I don't want the thumbnails.

And I can erase the original one... so

Could be a solution for me, to CANCEL the thumbnails creation.

Someone now to do that?
Logged
Pages: [1]   Go Up
 

Page created in 0.029 seconds with 20 queries.