Displaying 20 results from an estimated 20000 matches similar to: "send_data image"
2009 Nov 08
2
send_data with jpeg not working
I''m a newbie having trouble using send_data to send a jpeg file to the
browser for display in an html img tag. This is the relevant code
from my controller (photos_controller.rb):
def retrieve
@photo = Photo.find(params[:id])
send_data File.read(@photo.abs_img_path), :type => "image/
jpeg", :disposition => "inline"
end
def download
@photo =
2006 Jan 09
6
Rendering dynamic Gruff image (send_data)
Dears,
Got a controller witch do a send_data for displaying a chart.
like :
send_data(g.to_blob, :filename => "any.png", :type => ''image/png'',
:disposition=> ''inline'')
I actually do a
<img src="http://myhost:3000/stats/make_graph" />
Is there any way more clean to do that ? At minima don''t hardcode the
beginning
2010 Feb 24
6
Yet another send_data :image question...
Guys & gals,
I''m also learning RoR (using v2.3.4). I''ve got a basic scaffold
working for image file creation, and - to a point - image file
display.
The send_data function is working in my controller - no problem. The
model code is able to parse the uploaded file construct too.
def show
@image = Image.find(params[:id])
send_data(@image.binary_data, :type =>
2010 Apr 29
2
send_data => invalid byte sequence in US-ASCII
I''m trying to display a generated .png plot via send_data(), but it
results in a server error "invalid byte sequence in US-ASCII" error.
I''m pretty sure this means that I need to specify the encoding
somewhere, but I haven''t been able to figure out where or how to do so.
Some particulars:
I''m running gnuplot through a pipe to generate a plot in .png
2008 Apr 15
4
trouble streaming images with send_data
Hi
I''m doing some server-side graphics with Java2D and I''m trying to
stream the resulting image to the browser using send_data. When I try
to view the image that I streamed, the browser just shows the URL in
the window as a very small image (about .4 kb) when I am using jpeg
format. For png, it tells me that the image has errors and can''t load
it.
Here''s what
2008 Oct 08
11
Using image_tag and send_data
I am using image_tag to load an image that I''ve saved to the database
(using attachment_fu if you''re curious but that''s probably not
relevant here):
VIEW
<%= image_tag ''/photo/get_image/5'' %>
CONTROLLER
def get_image
@photo=Photo.find(params[:id])
send_data(DbFile.find(@photo.db_file_id).data,
:type =>
2007 Apr 09
6
gruff send_data
Hi,
for those with experience of Gruff module: suppose I want to send
image from server straight to the browser (as example on gruff web
site):
send_data(g.to_blob,
:disposition => ''inline'',
:type => ''image/png'',
:filename => "gruff.png")
the server seems sending this binary data ok, but I am having
2010 Nov 03
2
send_file but not send_data?
So this is the original code I used, and it worked
send_file ''vendor/sprites/not-found.png'', {:filename =>
"sprite-not-found.png", :type => "image/png", :disposition => "inline"}
Now I switched it to this (going to be adding imageMagick)
send_data File.read(''vendor/sprites/not-found.png''), {:filename =>
2006 Apr 05
1
send_file VS. send_data (performance)
Does anybody know if there is a big performance/time cost difference
between these two methods of serving a file:
------------------------------- #1
-----------------------------------------
send_file "test.png", :type => ''image/png'', :disposition => ''inline''
-------------------------------
#2------------------------------------------
2007 Feb 07
2
Image Downloads in IE
Hi,
This may not be a rails issue, if not apologies.
I have an application which allows image downloads.
The image is downloaded with the code:
send_data(@wallpaper.image,
:filename => @wallpaper.path,
:type => @wallpaper.image_content_type,
:disposition => "downloaded")
However, Internet Explorer doesn''t download the image, it
2008 Feb 18
3
Displaying a base64-encoded image within an rhtml template
I''m working on generating FedEx labels for quick & easy shipping.
FedEx returns the label as a base64-encoded string. Assuming that
''match'' is the base64 string containing the label data, here is what I
have to display the image:
send_data image, :filename => ''fedex_shipping_label.png'', :type =>
''image/png'', :disposition
2010 May 03
7
rendering images dynamically
Hi,
I have a rails application where I respond to a request by fetching
image urls from various web api calls and need to display them as they
come available. I am able to display all the images once I get them
all, but that causes an unacceptable delay for my user.
One approach I am trying is, from my controller, set an @image
variable, and then pass in a block to the model that retrieves the
2006 Apr 27
7
SuperImage plugin
Greetings all,
This is the first release of the SuperImage plugin. The idea is you
upload images to the database, and then pull them out at any size you
want. Combine this with caching and it will stay light and fast.
More info and instructions are here:
http://beautifulpixel.textdriven.com/articles/2006/04/27/superimage-plugin-making-resizeable-uploaded-images-easy
svn:
2006 May 17
0
send_data not working properly with link_remote_to
I''m reading an image in an link_to_remote call,and then using send_data
i send the read image as :type => "image/png" :disposition =>
"inline"...but when the div tag gets updated i see only ascii characters
.....but if i do the same operation using normal call(link_to) i see it
functioning normal ....could someone explain .
my view:
<%=
2008 Jul 10
2
Need Browser to Not Cache Ajax Image
I am banging my head against the wall here. I have a gd-generated image that
keeps being changed via ajax on my page. Since the image is generated based
on querystring parameters (which don''t change) but is based on a model (that
is constantly changing), the browser caches the image and you have to do a
page refresh to update the image. I have hacked around it by appending a
random number
2008 Nov 03
3
MS-SQL deliveres binary image as array
Hello!
I need to display images stored in a MS-SQL database but I get the
following error:
NoMethodError (undefined method `unpack'' for #<Array:0x48cbff0>):
c:/ruby/lib/ruby/1.8/base64.rb:59:in `decode64''
I guess its because MS-SQL delivers an arry...
Is there a solution to this problem??
Please help me!
lacky
--
Posted via http://www.ruby-forum.com/.
2007 Jun 07
6
Can't download files with send_data or send_file
I have a form_remote_tag that calls a method to print out a csv file
for download. If I tell the form_remote_tag to update a div the data
comes up in that div, but otherwise I can''t get the browser to
acknowledge the sent file.
>From view:
<%= form_remote_tag :url => {:action => "csv_dump" }%>
<%= submit_tag "Download Complete List" ,:name
2006 Jan 04
4
How to open a pdf file in new window
Hi all
I made a pdf file in ruby and to display it used the method send_data
like
#
send_data pdf.render, :filename => "Hello.pdf",:type =>
"application/pdf"
#
Now I want to open it in another window or as a popup. How can I achieve
it?
Thanks to all.
Sainaba.
--
Posted via http://www.ruby-forum.com/.
2006 Jun 06
9
How to protect images from public?
Hi,
I''m trying to figure out the best way to protect images uploaded by
users who may wish to keep them private.
For example, if they are uploaded in the default file_column location
(/public/blah/blah/1/) then someone can simply type the URL
http://www.blah.com/blah/blah/1 and get the image.
I can store the images in a non-public directory in the rails app (ie:
/railsapp/images/X/)
2009 Jan 14
1
setting header in views?
currently iam using FasterCSV to render csv pages
format.csv do
csv_string = FasterCSV.generate do |csv|
# header row
csv << @query_result[0].keys
@query_result.each do |x|
csv << x.values
end
end
#send it to the browser
send_data csv_string,
:type => ''text/csv;