I am trying to use FlexImage after droping file_column but can not seem to get it to work, please help.
Model
I am trying to use FlexImage after droping file_column but can not seem to get it to work, please help.
Model
Thanks Alex, I am getting closer, but still not there.
I renamed the MediumBlob column to data and made a show_image function and show_image.flexi view. I made the other changes you suggested too. I am still only seeing the alt tag but at least the HTML output looks better. It is still adding a .png to the end (I added the custom route, but it seems to not be working.)
Controller
> def show_my_image > @image = LibResouce.find(params[:id]).image The name of this action here needs to match
> <%= image_tag image_url(:controller => 'lib_resources', :action => > 'show_image', :id => @mod) %>
the name of the action here. So you have an action on your controller called "show_my_image" that renders an image, and in your view you are calling the action "show_image". Obviously this will not work.
of course - brain fart/typo - fixed it
> Views > ---------- > #show_image.flexi > @image.resize! :size => "250x250" #do I need to call the size/resize > action if I am pre-processing the image in the model?
If that's really the case all you need in your view file is:
@image
I meant that I was doing this in the model: pre_process_image :size => '250x250' # isn't this a FlexImage call?
> Routes.rb > -------------- > map.image ':controller/:action/:id.jpg' # is this right?
> HTML Output > ---------------------- > <img alt="56" src="http://localhost:3002/lib_resources/show_image/ > 56.png" />
Are you sure you are on rails 1.2? Try this route instead:
map.image ':controller/:action/:id/image.jpg'
No I have not updated to 1.2 yet - but I tried both ways and neither worked I removed the flexi file and put this line back in my controller: flex_image :action => 'show_image',:class => LibResource
I am still only seeing an alt tag
HTML
Still Stuck on this.
THANKS! That worked. The problem was this: Try making sure the route is above the default ‘:controller/:action/:id’ route.
I have a couple more questions/problems if your up to it.
2.I need to be able to make a copy of the model with the image. Copying the model makes a new row in the database with a new id. The idea is to allow users to add the model with the image on more than one webpage - but also let them edit the model on one page without effecting the model on the original page - that is why I need multiple copies in the database - each page points to it’s own image model.
The problem is that I can not copy the model with the image. I am not getting any errors - its just not saving the model. How can I make a copy of the model with an image?
Code (this works fine for the models that no not have an image)
Thanks so much, Alex. I will not be able to try anything out until Monday - but I have high hopes.
Again thanks for your time and effort - its contributors like you that make this such a good forum.
~K