I have D6.13

How to reproduce a bug:

1. Resize some .jpg file to be smaller than 550x550 pixels. 170x400 or 400x300 will be fine.
2. Set in /admin/settings/gallery_assist "Preview upload size" parameter to 550 and "Preview display size" to 550. But for me making them lower won't help at all...
3. Upload file to gallery. It will appear in gallery_assistXXX/img/ folder, and in gallery_assistXXX/thm/ folder, but not in the gallery_assistXXX/ folder. So it will not open with light-boxes (at least with lytebox).

Sometimes files in gallery_assistXXX/prev/ wasn't created too, and I still can't deduce why. Try to check with attached file, it isn't appeared in this folder. Such files disappear in standard gallery preview, but appear in lytebox.

CommentFileSizeAuthor
#5 fail2.gif1.36 KBdzhu
fail.jpg31.06 KBdzhu

Comments

jcmc’s picture

Hi dzhu,

Ok I check it

Thanks and Regards
Juan Carlos

jcmc’s picture

hello dzhu,

I tested in my enviroment and the fail.jpg will uploaded without problems.

Later I search for a reason, wy you get this error and change a line. It is not special but I think is better.

Not all php img libraries versions ignore the diference betwen "upload size rule" and "file dimentions ".

So I change the upload size rule to the file dimention if the file dimention is smaller as the rule.
search for $prev_size = $conf['upload_prev'];

cahnge to $prev_size = $my_dim_ref > $conf['upload_prev'] ? $conf['upload_prev'] : $my_dim_ref;

give me please fedback if this works.

Regards
Juan Carlos

arpadkiss’s picture

I had same problem (I tested seven small jpg files) but your change is working well for me.

Thanks!

jcmc’s picture

Status: Active » Fixed
dzhu’s picture

Status: Fixed » Active
StatusFileSize
new1.36 KB

Well, I have changed the module as you suggested, but it didn't help. I have made some investigations and found the following:

                  $thmb_size = $conf['upload_thm'];
                  image_scale($new_filepath, $upload_thm, $thmb_size, $thmb_size); 
                  $imageinfo = image_get_info($new_filepath);
                  $my_dim_ref = $imageinfo['width'] > $imageinfo['height'] ? $imageinfo['width'] : $imageinfo['height'];
                  $prev_size = $my_dim_ref > $conf['upload_prev'] ? $conf['upload_prev'] : $my_dim_ref;
                  if ($prev_size <= $my_dim_ref) {
                    image_scale($new_filepath, $upload_prev, $prev_size, $prev_size);
                  }
                  else {
                    rename($new_filepath, $upload_prev);
                  }

In this part of the code (already fixed with your additional line) image will be scaled to $prev_size even it has the same size. But if is will not be scaled, it will be moved from original location by this command: rename($new_filepath, $upload_prev); and image disappeared from image folder for that gallery...

I have changes if argument to '<', changes rename to copy function, and have added the same if --- else construction instead image_scale($new_filepath, $upload_thm, $thmb_size, $thmb_size); function. Here is the result:

                 // Cheking sizes
                  $thmb_size = $conf['upload_thm'];
                  $imageinfo = image_get_info($new_filepath);
                  $my_dim_ref = $imageinfo['width'] > $imageinfo['height'] ? $imageinfo['width'] : $imageinfo['height'];
                  $prev_size = $my_dim_ref > $conf['upload_prev'] ? $conf['upload_prev'] : $my_dim_ref;

                     // Making copying or image scaling
                     if ($thmb_size < $my_dim_ref) {
                                                    image_scale($new_filepath, $upload_thm, $thmb_size, $thmb_size);
                                                   }
                     else {
                           copy($new_filepath, $upload_thm);
                          }

                     if ($prev_size < $my_dim_ref) {
                                                    image_scale($new_filepath, $upload_prev, $prev_size, $prev_size);
                                                   }
                     else {
                           copy($new_filepath, $upload_prev);
                          }

I have also moved all size checking and calculations at first lines, and image scaling to the end.

But I still can't upload files like attached to this message. File will not appear in sites/default/files/gallery_assist/UID/gallery_assistNID/img/ folder. I think it is somehow connected with the fact, that this file smaller even than 80x80, thumbnail size.

Please check and test it if necessary.

jcmc’s picture

hello dzhu,

I dont know way and I would like to know the reasons.

For example here is installed the gallery assist 1.6 with all the issues you know and we have fixed in the last days.

It is realy so but here I upload a mini image and it woks without problems. > gallery-test-upload-mini-images.

you're the only one today who has this problem.?

I am very interested that Gallery Assist work in all environments.

For example we dont speak never about wich php image library you have in using.

Ok I am sure some when there is a solution for this

Regards
Juan Carlos

dzhu’s picture

I have tested with images from your gallery, and found that all BarbusDenisonii*.jpg and 9f6468e04649b2c50f879ea4a3a3c037.png files haven't appeared in the same sites/default/files/gallery_assist/UID/gallery_assistNID/img/ folder.

I'm using the following server (if you need more information about my server environment, please ask):

FreeBSD 6.3-RELEASE-p11, PHP Version 5.2.11

gd
GD Support enabled
GD Version bundled (2.0.34 compatible)
FreeType Support enabled
FreeType Linkage with freetype
FreeType Version 2.1.10
GIF Read Support enabled
GIF Create Support enabled
JPG Support enabled
PNG Support enabled
WBMP Support enabled
XBM Support enabled

Finally, I have changed the module file in the following way, from this:

                rename($filepath, $new_filepath);
                image_scale($new_filepath, $gallery_assist_thumbnail, 80, 80);

                if ($conf['use_imagecache'] == 0) {
                  $thmb_size = $conf['upload_thm'];
                  $imageinfo = image_get_info($new_filepath);
                  $my_dim_ref = $imageinfo['width'] > $imageinfo['height'] ? $imageinfo['width'] : $imageinfo['height'];
                  $prev_size = $my_dim_ref > $conf['upload_prev'] ? $conf['upload_prev'] : $my_dim_ref;

                     if ($thmb_size < $my_dim_ref) {
                                                    image_scale($new_filepath, $upload_thm, $thmb_size, $thmb_size);
                                                   }
                     else {
                           copy($new_filepath, $upload_thm);
                          }

                     if ($prev_size < $my_dim_ref) {
                                                    image_scale($new_filepath, $upload_prev, $prev_size, $prev_size);
                                                   }
                     else {
                           copy($new_filepath, $upload_prev);
                          }
                  // Clear the cached filesize and refresh the image information.
                  clearstatcache();
                }

to that:

                rename($filepath, $new_filepath);
                $imageinfo = image_get_info($new_filepath);
                $my_dim_ref = $imageinfo['width'] > $imageinfo['height'] ? $imageinfo['width'] : $imageinfo['height'];

	            if (80 < $my_dim_ref) {
                                                     image_scale($new_filepath, $gallery_assist_thumbnail, 80, 80);
                                                    }
                    else {
                           copy($new_filepath, $gallery_assist_thumbnail);
                         }

                if ($conf['use_imagecache'] == 0) {
                  $thmb_size = $conf['upload_thm'];
                  $prev_size = $my_dim_ref > $conf['upload_prev'] ? $conf['upload_prev'] : $my_dim_ref;

                     if ($thmb_size < $my_dim_ref) {
                                                                  image_scale($new_filepath, $upload_thm, $thmb_size, $thmb_size);
                                                                 }
                     else {
                             copy($new_filepath, $upload_thm);
                            }

                     if ($prev_size < $my_dim_ref) {
                                                                  image_scale($new_filepath, $upload_prev, $prev_size, $prev_size);
                                                                }
                     else {
                             copy($new_filepath, $upload_prev);
                            }
                  // Clear the cached filesize and refresh the image information.
                  clearstatcache();
                }

So I made the function image_scale() to be called only if image is bigger. It isn't the most beautiful solution, but it works, even with pictures from your test gallery.

jcmc’s picture

hi dzhu,

I do not think so.

just as you did it, it's better. It is simple but EFFECTIVE. It can work anywhere.

I'll take it.

I think I have to sleep a little JAJAJA

I thank you very mush.

Regards
Juan Carlos

dzhu’s picture

Hi Juan Carlos,

Why not. But please have in mind, that I actually don't know PHP, so I can create incorrect constructions in my suggested changes. Therefore please check my code before making any changes in the module. ^_^

About my gallery, I'm waiting for some new additions by another users, and I hope, there will be no errors. After that I can conclude that this bug went out.

jcmc’s picture

Hello dzhu,

No problems. When I sad you I takeover you solution I mean I implement your proposition but not I copy and paste the code.
For example I make a bug self by copy and paste and when you have downloaded the version 6.x-1.x-dev-1.9 your uploader not scale the preview.
I make so waht no nore ;-D

I fixed it and it work now 'thank God' correktly. You can download the 6.x-1.x-dev-1.10.

A new feature is implemented.
Gallery Assist support now the changes of owner.
For example when you change the Author the module make a full mov from the Gallery and belong the new user.

I am happy with your propositions.
Regards
Juan Carlos

jcmc’s picture

Status: Active » Fixed
jcmc’s picture

Status: Fixed » Closed (fixed)