On admin/settings/uploads when I set the max dimensions for an image to 510x510, then upload an image attached to say, a page, GD properly scales the image. When I attach the same file to my Galleria node, it does not scale the image.

Why not? I thought perhaps Galleria was "getting to the image first," so I increased it's module weight to 1 in the system table (the rest of the modules, including upload, were 0). It still does not scale the image, though.

So, is there something in the code that does not let the toolkit process the image? I looked through the .module but couldn't see anywhere that I thought was interfering with upload module's ability to process images.

Comments

Mark Theunissen’s picture

Hi cwells,

I actually had no idea that the Upload module scaled images! Learn something new every day. Anyway, if Galleria is interfering with this process, it's definitely not intentional.

Does the Upload module keep a copy of the original unscaled image? Maybe Galleria is referring by default to the original image... will investigate for you sometime soon.

chrisfromredfin’s picture

I'm digging into this for just a little bit now... one thing I'm seeing is that it IS calling the validation function:

about to call file_validate_image_resolution with :: Array ( [0] => stdClass Object ( [filename] => p6280026.jpg [filepath] => /tmp/phpmoDnrA [filemime] => image/jpeg [source] => upload [destination] => sites/default/files/p6280026.jpg [filesize] => 467851 ) [1] => 510x510 ) 

and I'm even getting a (drupal_set_)message "The image was resized to fit within the maximum allowed dimensions of 510x510 pixels."

So I dug a little deeper... it seems the upload module *IS* resizing the image! When I go to the file directly (/sites/default/files/p6280026.jpg), it displays at 510x510. But when displayed through Galleria, it seems to be using the original size (1600x1200). So, are you storing the filesize of the original upload and setting the height and width on the img directly? Or grabbing the size from EXIF or something?

This is probably all done in JS, methinks... I'm looking around now but JS isn't as much my forte.

chrisfromredfin’s picture

Status: Active » Closed (fixed)

Doh. I'm pretty sure that actually the problem was that I kept testing with the exact same files, and my browser had them cached from before I set the file image dimensions. Marking closed.