Getting the height and width of a given photo

hey,

i have a submit form, where u can upload a file (only photos)

this i my code

def create
@fsimage = Fsimage.new(params[:fsimage])
parent_id = params[:parent_id]
parent_class = params[:parent_class]
url = params[:url]
file = params[:file][:file]

original_filename = file.original_filename
@fsimage.filename = original_filename
arr_filetype = original_filename.split(".")
@fsimage.filetype = arr_filetype[arr_filetype.length - 1]
parent_object = parent_class.constantize.find(parent_id)

#TODO setting order
index_col = 0
images = parent_object.fsimages
for image in images
	if image.index_col > index_col
		index_col = image.index_col
	end
end
index_col += 1
@fsimage.index_col = index_col

    if parent_object != nil && @fsimage.save
	parent_object.fsimages << @fsimage
	filename_on_system = SaveImageFiletoDisk(file, @fsimage)
	if filename_on_system == nil
		Dir.delete(getImageStorageDir() + "/" + @fsimage.id.to_s)
		Fsimage.find(@fsimage.id).destroy
	else
		@fsimage.filesize = File.size(filename_on_system)
		@fsimage.filename = filename_on_system.gsub("public", "")
                    =>>>>>>> WIDTH AND HEIGHT
		@fsimage.save
	end
	flash[:notice] = 'Image was successfully created.'
	redirect_to url
else
	render :action => 'new'
end

end

How can i get the width and the height of the file?

Hi Nick,

Nick B. wrote:

How can i get the width and the height of the file?

You might look into RMagick, if you haven’t already.