Hi There, how can I handle (show,edit,delete) Large Objects e.g. images in a PostgrSQL DB. Is scaffold useable. In the default scaffold views I cant see any images. An example would be very usefull. Regards and thank you Torsten
On 04/08/05, Torsten Senf <senf-RVOBs+JzQf04njdhC6Vpyg@public.gmane.org> wrote:> Hi There, > > how can I handle (show,edit,delete) Large Objects e.g. images in a PostgrSQL DB. > Is scaffold useable. In the default scaffold views I cant see any images. > > An example would be very usefull. >Hello, Although postgresql has BLOB support, I''d strongly advice against storing images inside the Database. It''s a performance killer. Instead, you could keep your images in a directory like public/images and store the images URL''s in a table field. Best regards, Sebastian A. Espindola
Sebastian A. Espindola wrote:> On 04/08/05, Torsten Senf <senf-RVOBs+JzQf04njdhC6Vpyg@public.gmane.org> wrote: > >>Hi There, >> >>how can I handle (show,edit,delete) Large Objects e.g. images in a PostgrSQL DB. >>Is scaffold useable. In the default scaffold views I cant see any images. >> >>An example would be very usefull. >> > > > Hello, > Although postgresql has BLOB support, I''d strongly advice against > storing images inside the Database. It''s a performance killer. Instead, > you could keep your images in a directory like public/images and store > the images URL''s in a table field.If you enable uploading images, that easily can turn into a security hole. Better store the images outside of public/ and use send_file from the controller to stream it down to the client.. (and yeah, avoid storing them in the DB by any means :) Kristof
I''ve been asking this off and on for the past couple months, never get a response. So if you find out, let me know :) On 8/4/05, Torsten Senf <senf-RVOBs+JzQf04njdhC6Vpyg@public.gmane.org> wrote:> Hi There, > > how can I handle (show,edit,delete) Large Objects e.g. images in a PostgrSQL DB. > Is scaffold useable. In the default scaffold views I cant see any images. > > An example would be very usefull. > > Regards and thank you > > Torsten > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >
On 2005-08-04 11:33, Sebastian A. Espindola wrote:> On 04/08/05, Torsten Senf <senf-RVOBs+JzQf04njdhC6Vpyg@public.gmane.org> wrote: > > Hi There, > > > > how can I handle (show,edit,delete) Large Objects e.g. images in a PostgrSQL DB. > > Is scaffold useable. In the default scaffold views I cant see any images. > > > > An example would be very usefull. > > > > Hello, > Although postgresql has BLOB support, I''d strongly advice against > storing images inside the Database. It''s a performance killer. Instead, > you could keep your images in a directory like public/images and store > the images URL''s in a table field. >Could you give an example of inserting, selecting an image in a postgresql DB. Perdormance is not so important. Thank you Torsten
Hi Torsten, You may want to take a look at http://wiki.rubyonrails.com/rails/show/HowtoUploadFiles Dylan.>Could you give an example of inserting, selecting an image in a postgresql >DB. Perdormance is not so important. > >Thank you > >Torsten > >
On 2005-08-05 19:49, Dylan Egan wrote:> Hi Torsten, > > You may want to take a look at > http://wiki.rubyonrails.com/rails/show/HowtoUploadFilesThank you for the hint. I tried the send_data method but I got only the oid as an ASCII File. I think there is a difference between MySQL BLOB and Large Object in PostgreSQL. I search for a method to get/put Large Objects from/in a PostgreSQL DB via Rails. Any experiences out there ? Thank you. Torsten
I was able to get it working in PostgreSQL by sticking pretty close to the upload files example and an example from the Agile rails book. I ended up storing the picture directly in the table as a BYTEA column type rather than as an OID referenced from the table. Something like CREATE TABLE pictures ( id SERIAL NOT NULL, name VARCHAR(200), data BYTEA, PRIMARY KEY (id) }; Using the same view in the example on the wiki, the controller and model look something like this The controller action does def create pic = Picture.new(@params[:person]) end Then in the Picture model we have def picture=(pic) self.data = pic.read end If someone was able to get it working as a BLOB (OID) i''m curious to see how that works. On 8/5/05, Torsten Senf <senf-RVOBs+JzQf04njdhC6Vpyg@public.gmane.org> wrote:> On 2005-08-05 19:49, Dylan Egan wrote: > > Hi Torsten, > > > > You may want to take a look at > > http://wiki.rubyonrails.com/rails/show/HowtoUploadFiles > > Thank you for the hint. I tried the send_data method but I got only the oid > as an ASCII File. I think there is a difference between MySQL BLOB and Large > Object in PostgreSQL. > > I search for a method to get/put Large Objects from/in a PostgreSQL DB via > Rails. Any experiences out there ? > > Thank you. > > Torsten > > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >-- When you meet a master swordsman, show him your sword. When you meet a man who is not a poet, do not show him your poem. -- Rinzai, ninth century Zen master