कैरियरवेव के वर्तमान उदाहरण की चौड़ाई और ऊंचाई कैसे प्राप्त कर सकता हूं?कैरियरवेव छवि आयाम
कुछ इस तरह:
car_images.each do | image|
image_tag(image.photo_url, :width => image.photo_width, :height => image.photo_height)
end
दुर्भाग्य image.photo_width
और image.photo_height
काम नहीं कर रहे। मुझे छवियों की चौड़ाई और ऊंचाई निर्दिष्ट करने की आवश्यकता है, यह उपयोग की जा रही jquery प्लगइन पर आवश्यक है। यदि Rmagick का उपयोग कर काफी आसानी से
class Image
before_save :update_image_attributes
private
def update_image_attributes
if image.present?
self.content_type = image.file.content_type
self.file_size = image.file.size
self.width, self.height = `identify -format "%wx%h" #{image.file.path}`.split(/x/)
# if you also need to store the original filename:
# self.original_filename = image.file.filename
end
end
end
यह नए अपलोड ('image_changed? == true') के लिए काम करता है लेकिन मौजूदा अनुलग्नकों के आयामों को मापने के बारे में क्या है? मैं कंसोल से 'get_geometry' विधि तक पहुंच नहीं पा रहा हूं। मुझे # 'कैरियरवेव :: स्टोरेज :: फॉग :: फ़ाइल: 0x00000005225b28> '" के लिए बुलाया गया "निजी विधि' फ़ाइल मिल रही है। –