Saving Thumbs and Resized pics to different directory??? Saving Thumbs and Resized pics to different directory???
 

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Main Menu

Saving Thumbs and Resized pics to different directory???

Started by crackers, January 12, 2011, 07:13:13 PM

Previous topic - Next topic

0 Members and 2 Guests are viewing this topic.

crackers

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?

Αndré

Recently a user told me that he uses something like
_res/res_
_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.

thomasFRU

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

webcalidad

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.


thomasFRU

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

webcalidad

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

--------------------------------------------------------------------------

Αndré

Quote from: webcalidad on March 08, 2011, 10:45:48 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.

thomasFRU

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

Αndré

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.

thomasFRU

thats right,

my mail was in relation to the mail before from webcalidad

Αndré


webcalidad

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?