I am writing a little photo gallery with Rails 3.0.11 and MiniMagick.
def JadeImage.rescale path,new_path,max_height=150
image = MiniMagick::Image.open(path)
image.adaptive_resize(self.resize(image[:height],max_height))if image[:height] > max_height
image.write(new_path)
end
I am using this to save two resized images from the same photo. One of the files gets saved with 644 permissions and all is right in the world. The other always get saved as 600 and as such can't be displayed in the webpage.
For now, after saving them, I run a little utility to set everything in that directory as 644 so it works now.
Is there any reason why this would occur?
This is how I resolved this issue on my end. If you are using apache try adding to your apache2.conf
PassengerUserSwitching Off
PassengerDefaultUser www-data
PassengerDefaultGroup www-data