How to access a model method from within a view?

and dont forget to add height and width to the attr_accessible list and
fix
this

height = dimensions.height
width = dimensions.width

to

self.height = dimensions.height
self.width = dimensions.width

also you can remove the style from

has_attached_file :photo, :styles => {
:original => [“100%”, :jpg] ,
}

to

has_attached_file :photo

and you have an extra comma that does not goes there

at the end it should look similar to this

has_attached_file :image,
:url => “/system/assets/images/:id/:style/:basename.:extension”,
:path =>
“:rails_root/public/system/assets/images/:id/:style/:basename.:extension”
validates_attachment_presence :image
validates_attachment_size :image, :less_than=> 800.kilobytes
validates_attachment_content_type :image, :content_type =>
%r{image/.*}

the red charactesr means you should but the size you want there, you can
remove

validates_attachment_size :image, :less_than=> 800.kilobytes

if you dont want to set a limit.

/*********************************/

my replies have many typos , some time i write ‘user’ instead of
‘used’
and ‘is’ instead of ‘if’
you may want to check that in case something is not clear

sorry im an idiot

def after_save
uploaded_file = photo.queued_for_write[:original]
dimensions = Paperclip::Geometry.from_file(uploaded_file)
height = dimensions.height
width = dimensions.width
end
end

is after save not before, in the before
Paperclip::Geometry.from_file(uploaded_file) does not exist

let me go check that because rigth now im telling you everything from
memory, ill go see the right way to do it and the reply to you

radhames brito wrote:

did you created the fields in the database? do that and it should work

Yes, I have created the fields in the database as follows:

rails script generate migration AddWidthToDicom width:integer

And,

rails script generate migration AddHeightToDicom height:integer

But, still the same.

radhames brito wrote:

Can you wait a while ? im going to make an example project but instead
of
use dicom image ill use a normal image, i will upload the project to
github
so you can check it out. ok?

@radhames, sure, that sounds great.

I really appreciate your efforts.

Looking forward for your example.

Can you wait a while ? im going to make an example project but instead
of
use dicom image ill use a normal image, i will upload the project to
github
so you can check it out. ok?

i just had lunch, and im going to take a nap after that ill work on it

radhames brito wrote:

i just had lunch, and im going to take a nap after that ill work on it

Take your time @radhames.

Thanks a lot. :slight_smile:

On 19 September 2010 18:52, Abder-Rahman A. [email protected]
wrote:

But, still the same.

Did you run the migrations?
rake db:migrate

Colin

radhames brito wrote:

i just had lunch, and im going to take a nap after that ill work on it

Hi @radhames. Have you built up the application yet?

Thanks.

Colin L. wrote:

On 19 September 2010 18:52, Abder-Rahman A. [email protected]
wrote:

But, still the same.

Did you run the migrations?
rake db:migrate

Colin

Yes, I did.

not done yet be ready in an hour, i just arrive at work and have to
install
rails 3 in this machine, can you wait?

radhames brito wrote:

not done yet be ready in an hour, i just arrive at work and have to
install
rails 3 in this machine, can you wait?

Sure, @radhames. That’s fine.

its done im gona upload it to github now, is very basic , tell me any
features you wan added, by tomorrow ill add tooltip and other cool
thing,
also tell me if you want to have galleries per user.

radhames brito wrote:

its done im gona upload it to github now, is very basic , tell me any
features you wan added, by tomorrow ill add tooltip and other cool
thing,
also tell me if you want to have galleries per user.

Thanks a lot @radhames. Appreciate it.

Can you give us the link to github?

http://github.com/rbritom/Images_handling_examples

sorry was uploading and setting up this pc to work with github

there is an error where in the show action it should say width and
height
and is saiy width and width again

radhames brito wrote:

http://github.com/rbritom/Images_handling_examples

sorry was uploading and setting up this pc to work with github

Thanks a lot @radhames. That’s fine.

Really helpful.

radhames brito wrote:

i screwed up my rsa key and i cant update from this pc, ill fix
everything
when i get home.

That’s fine. Appreciate your efforts.

i screwed up my rsa key and i cant update from this pc, ill fix
everything
when i get home.