PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Autres forums > Forum Programmation & Conception > comp.lang.ruby > Create image, send to rails
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
Create image, send to rails

Réponse
 
LinkBack Outils de la discussion
Vieux 05/01/2008, 14h21   #1
macaco
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Create image, send to rails

[Note: parts of this message were removed to make it a legal post.]

Hi, I'm new to this language, so any will be welcome.

I'm trying to create images at random, not a problem with this, and I can do
it on ruby alone saving the image to the filesystem and watching it later on
a viewer.

Buy when I try to use RoR, like creating the image on the fly, not saving it
to the filesystem, and presenting it on the browser.... well, i get
confused. All I can do so far, it's to show the image i have generated on
ruby before.

btw, i'm using RMagick to do the trick.

  Réponse avec citation
Vieux 05/01/2008, 21h30   #2
Bira
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Create image, send to rails

On Jan 5, 2008 12:21 PM, macaco <macacoangel@gmail.com> wrote:
> Hi, I'm new to this language, so any will be welcome.
>
> I'm trying to create images at random, not a problem with this, and I can do
> it on ruby alone saving the image to the filesystem and watching it later on
> a viewer.
>
> Buy when I try to use RoR, like creating the image on the fly, not saving it
> to the filesystem, and presenting it on the browser.... well, i get
> confused. All I can do so far, it's to show the image i have generated on
> ruby before.
>
> btw, i'm using RMagick to do the trick.
>


You can probably use send_data in your controller for this.

http://api.rubyonrails.org/classes/A...g.html#M000229




--
Bira
http://compexplicita.blogspot.com
http://sinfoniaferida.blogspot.com

  Réponse avec citation
Vieux 08/01/2008, 16h16   #3
macaco
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Create image, send to rails

[Note: parts of this message were removed to make it a legal post.]

On Jan 5, 2008 4:30 PM, Bira <u.alberton@gmail.com> wrote:

> On Jan 5, 2008 12:21 PM, macaco <macacoangel@gmail.com> wrote:
> > Hi, I'm new to this language, so any will be welcome.
> >
> > I'm trying to create images at random, not a problem with this, and I

> can do
> > it on ruby alone saving the image to the filesystem and watching it

> later on
> > a viewer.
> >
> > Buy when I try to use RoR, like creating the image on the fly, not

> saving it
> > to the filesystem, and presenting it on the browser.... well, i get
> > confused. All I can do so far, it's to show the image i have generated

> on
> > ruby before.
> >
> > btw, i'm using RMagick to do the trick.
> >

>
> You can probably use send_data in your controller for this.
>
> http://api.rubyonrails.org/classes/A...g.html#M000229
>
>
>

Thanks, that was ing, but as I was having troubles with rmagic and
windows, i decided to switch to linux

problem is, after i installed everything listed on
http://rmagick.rubyforge.org/install-linux.html, trought apt-get on debian,
once I try to run the gem, this is what I get:

*macaco@ig88:/devel/rtst$ sudo gem install rmagick -r
Building native extensions. This could take a while...
ERROR: While executing gem ... (Gem::Installer::ExtensionBuildError)
ERROR: Failed to build gem native extension.

ruby extconf.rb install rmagick -r
extconf.rb:1:in `require': no such file to load -- mkmf (LoadError)
from extconf.rb:1


Gem files will remain installed in /var/lib/gems/1.8/gems/rmagick-2.0.0 for
inspection.
Results logged to /var/lib/gems/1.8/gems/rmagick-2.0.0
/ext/RMagick/gem_make.out*

Any ?

  Réponse avec citation
Vieux 08/01/2008, 17h08   #4
ara howard
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Create image, send to rails


On Jan 8, 2008, at 9:16 AM, macaco wrote:

> ruby extconf.rb install rmagick -r
> extconf.rb:1:in `require': no such file to load -- mkmf (LoadError)
> from extconf.rb:1


you ruby is broken. this file cannot be missing in a fully functional
ruby.

a @ http://codeforpeople.com/
--
we can deny everything, except that we have the possibility of being
better. simply reflect on that.
h.h. the 14th dalai lama




  Réponse avec citation
Vieux 08/01/2008, 19h26   #5
Juan Matías
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Create image, send to rails

It seems that you don't have building tools, try installing ruby1.8-dev and
build-essential, libgraphicsmagick1-dev packages.

Juan Matias


On Jan 8, 2008 1:16 PM, macaco <macacoangel@gmail.com> wrote:

> On Jan 5, 2008 4:30 PM, Bira <u.alberton@gmail.com> wrote:
>
> > On Jan 5, 2008 12:21 PM, macaco <macacoangel@gmail.com> wrote:
> > > Hi, I'm new to this language, so any will be welcome.
> > >
> > > I'm trying to create images at random, not a problem with this, and I

> > can do
> > > it on ruby alone saving the image to the filesystem and watching it

> > later on
> > > a viewer.
> > >
> > > Buy when I try to use RoR, like creating the image on the fly, not

> > saving it
> > > to the filesystem, and presenting it on the browser.... well, i get
> > > confused. All I can do so far, it's to show the image i have

> generated
> > on
> > > ruby before.
> > >
> > > btw, i'm using RMagick to do the trick.
> > >

> >
> > You can probably use send_data in your controller for this.
> >
> >

> http://api.rubyonrails.org/classes/A...g.html#M00022=

9
> >
> >
> >

> Thanks, that was ing, but as I was having troubles with rmagic and
> windows, i decided to switch to linux
>
> problem is, after i installed everything listed on
> http://rmagick.rubyforge.org/install-linux.html, trought apt-get on
> debian,
> once I try to run the gem, this is what I get:
>
> *macaco@ig88:/devel/rtst$ sudo gem install rmagick -r
> Building native extensions. This could take a while...
> ERROR: While executing gem ... (Gem::Installer::ExtensionBuildError)
> ERROR: Failed to build gem native extension.
>
> ruby extconf.rb install rmagick -r
> extconf.rb:1:in `require': no such file to load -- mkmf (LoadError)
> from extconf.rb:1
>
>
> Gem files will remain installed in /var/lib/gems/1.8/gems/rmagick-2.0.0fo=

r
> inspection.
> Results logged to /var/lib/gems/1.8/gems/rmagick-2.0.0
> /ext/RMagick/gem_make.out*
>
> Any ?
>




--=20
=ABQuien nunca ha cometido un error nunca ha probado algo nuevo.=BB

  Réponse avec citation
Vieux 09/01/2008, 18h12   #6
macaco
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Create image, send to rails

Thanks Juan Matias, but it was a little more trickier, had to download the
ImageMagick from ftp://ftp.imagemagick.org/pub/ImageMagick/ because debian
gutsy only have the 6.2.4 version, but ruby works with 6.3

anyway, I have this in my controller:

class GenerateController < ApplicationController
require 'RMagick'
include Magick
def index
end

def generate
render :text =3D> "<h1>hello world</h1><img src=3D'/generate/img/1' />"
end

def img
imgl =3D Magick::Image.new(100, 100) { self.background_color =3D 'red' =
}
img.format =3D 'JPG'
send_data(imgl.to_blob, {:type =3D> 'image/jpeg', :disposition =3D>
'inline'})
end

end

but I get this error in the browser:

SystemStackError in GenerateController#img
stack level too deep


RAILS_ROOT: ./script/../config/..
Application Trace | Framework Trace | Ful=
l
Trace
/devel/rtst/app/controllers/generate_controller.rb:13:in `img'
/devel/rtst/app/controllers/generate_controller.rb:13:in `img'

Any ?

On 1/8/08, Juan Mat=EDas <jmrepetti@gmail.com> wrote:
>
> It seems that you don't have building tools, try installing ruby1.8-devan=

d
> build-essential, libgraphicsmagick1-dev packages.
>
> Juan Matias
>
>
> On Jan 8, 2008 1:16 PM, macaco <macacoangel@gmail.com> wrote:
>
> > On Jan 5, 2008 4:30 PM, Bira <u.alberton@gmail.com> wrote:
> >
> > > On Jan 5, 2008 12:21 PM, macaco <macacoangel@gmail.com> wrote:
> > > > Hi, I'm new to this language, so any will be welcome.
> > > >
> > > > I'm trying to create images at random, not a problem with this, and

> I
> > > can do
> > > > it on ruby alone saving the image to the filesystem and watching it
> > > later on
> > > > a viewer.
> > > >
> > > > Buy when I try to use RoR, like creating the image on the fly, not
> > > saving it
> > > > to the filesystem, and presenting it on the browser.... well, i get
> > > > confused. All I can do so far, it's to show the image i have

> > generated
> > > on
> > > > ruby before.
> > > >
> > > > btw, i'm using RMagick to do the trick.
> > > >
> > >
> > > You can probably use send_data in your controller for this.
> > >
> > >

> >

> http://api.rubyonrails.org/classes/A...g.html#M00022=

9
> > >
> > >
> > >

> > Thanks, that was ing, but as I was having troubles with rmagic and
> > windows, i decided to switch to linux
> >
> > problem is, after i installed everything listed on
> > http://rmagick.rubyforge.org/install-linux.html, trought apt-get on
> > debian,
> > once I try to run the gem, this is what I get:
> >
> > *macaco@ig88:/devel/rtst$ sudo gem install rmagick -r
> > Building native extensions. This could take a while...
> > ERROR: While executing gem ... (Gem::Installer::ExtensionBuildError)
> > ERROR: Failed to build gem native extension.
> >
> > ruby extconf.rb install rmagick -r
> > extconf.rb:1:in `require': no such file to load -- mkmf (LoadError)
> > from extconf.rb:1
> >
> >
> > Gem files will remain installed in /var/lib/gems/1.8/gems/rmagick-

> 2.0.0for
> > inspection.
> > Results logged to /var/lib/gems/1.8/gems/rmagick-2.0.0
> > /ext/RMagick/gem_make.out*
> >
> > Any ?
> >

>
>
>
> --
> =ABQuien nunca ha cometido un error nunca ha probado algo nuevo.=BB
>


  Réponse avec citation
Vieux 10/01/2008, 13h32   #7
Juan Matías
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Create image, send to rails

def img
imgl =3D Magick::Image.new(100, 100) { self.background_color =3D 'red' }
img.format =3D 'JPG' <<<--------- img.format =3D 'JPG or imgl.format =3D=
'JPG'
?
send_data(imgl.to_blob, {:type =3D> 'image/jpeg', :disposition =3D>
'inline'})
end

On Jan 9, 2008 3:12 PM, macaco <macacoangel@gmail.com> wrote:

> Thanks Juan Matias, but it was a little more trickier, had to download th=

e
> ImageMagick from ftp://ftp.imagemagick.org/pub/ImageMagick/ because debia=

n
> gutsy only have the 6.2.4 version, but ruby works with 6.3
>
> anyway, I have this in my controller:
>
> class GenerateController < ApplicationController
> require 'RMagick'
> include Magick
> def index
> end
>
> def generate
> render :text =3D> "<h1>hello world</h1><img src=3D'/generate/img/1' />=

"
> end
>
> def img
> imgl =3D Magick::Image.new(100, 100) { self.background_color =3D 'red'=

}
> img.format =3D 'JPG'
> send_data(imgl.to_blob, {:type =3D> 'image/jpeg', :disposition =3D>
> 'inline'})
> end
>
> end
>
> but I get this error in the browser:
>
> SystemStackError in GenerateController#img
> stack level too deep
>
>
> RAILS_ROOT: ./script/../config/..
> Application Trace | Framework Trace |
> Full
> Trace
> /devel/rtst/app/controllers/generate_controller.rb:13:in `img'
> /devel/rtst/app/controllers/generate_controller.rb:13:in `img'
>
> Any ?
>
> On 1/8/08, Juan Mat=EDas <jmrepetti@gmail.com> wrote:
> >
> > It seems that you don't have building tools, try installing

> ruby1.8-devand
> > build-essential, libgraphicsmagick1-dev packages.
> >
> > Juan Matias
> >
> >
> > On Jan 8, 2008 1:16 PM, macaco <macacoangel@gmail.com> wrote:
> >
> > > On Jan 5, 2008 4:30 PM, Bira <u.alberton@gmail.com> wrote:
> > >
> > > > On Jan 5, 2008 12:21 PM, macaco <macacoangel@gmail.com> wrote:
> > > > > Hi, I'm new to this language, so any will be welcome.
> > > > >
> > > > > I'm trying to create images at random, not a problem with this,

> and
> > I
> > > > can do
> > > > > it on ruby alone saving the image to the filesystem and watching

> it
> > > > later on
> > > > > a viewer.
> > > > >
> > > > > Buy when I try to use RoR, like creating the image on the fly, no=

t
> > > > saving it
> > > > > to the filesystem, and presenting it on the browser.... well, i

> get
> > > > > confused. All I can do so far, it's to show the image i have
> > > generated
> > > > on
> > > > > ruby before.
> > > > >
> > > > > btw, i'm using RMagick to do the trick.
> > > > >
> > > >
> > > > You can probably use send_data in your controller for this.
> > > >
> > > >
> > >

> >

> http://api.rubyonrails.org/classes/A...g.html#M00022=

9
> > > >
> > > >
> > > >
> > > Thanks, that was ing, but as I was having troubles with rmagic an=

d
> > > windows, i decided to switch to linux
> > >
> > > problem is, after i installed everything listed on
> > > http://rmagick.rubyforge.org/install-linux.html, trought apt-get on
> > > debian,
> > > once I try to run the gem, this is what I get:
> > >
> > > *macaco@ig88:/devel/rtst$ sudo gem install rmagick -r
> > > Building native extensions. This could take a while...
> > > ERROR: While executing gem ... (Gem::Installer::ExtensionBuildError)
> > > ERROR: Failed to build gem native extension.
> > >
> > > ruby extconf.rb install rmagick -r
> > > extconf.rb:1:in `require': no such file to load -- mkmf (LoadError)
> > > from extconf.rb:1
> > >
> > >
> > > Gem files will remain installed in /var/lib/gems/1.8/gems/rmagick-

> > 2.0.0for
> > > inspection.
> > > Results logged to /var/lib/gems/1.8/gems/rmagick-2.0.0
> > > /ext/RMagick/gem_make.out*
> > >
> > > Any ?
> > >

> >
> >
> >
> > --
> > =ABQuien nunca ha cometido un error nunca ha probado algo nuevo.=BB
> >

>




--=20
=ABQuien nunca ha cometido un error nunca ha probado algo nuevo.=BB

  Réponse avec citation
Vieux 10/01/2008, 15h26   #8
macaco
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Create image, send to rails

Yeah, that was it... i'm sorry for my stupid error

On 1/10/08, Juan Mat=EDas <jmrepetti@gmail.com> wrote:
>
> def img
> imgl =3D Magick::Image.new(100, 100) { self.background_color =3D 'red'=

}
> img.format =3D 'JPG' <<<--------- img.format =3D 'JPG or imgl.format =

=3D
> 'JPG'
> ?
> send_data(imgl.to_blob, {:type =3D> 'image/jpeg', :disposition =3D>
> 'inline'})
> end
>
> On Jan 9, 2008 3:12 PM, macaco <macacoangel@gmail.com> wrote:
>
> > Thanks Juan Matias, but it was a little more trickier, had to download

> the
> > ImageMagick from ftp://ftp.imagemagick.org/pub/ImageMagick/ because

> debian
> > gutsy only have the 6.2.4 version, but ruby works with 6.3
> >
> > anyway, I have this in my controller:
> >
> > class GenerateController < ApplicationController
> > require 'RMagick'
> > include Magick
> > def index
> > end
> >
> > def generate
> > render :text =3D> "<h1>hello world</h1><img src=3D'/generate/img/1' =

/>"
> > end
> >
> > def img
> > imgl =3D Magick::Image.new(100, 100) { self.background_color =3D 're=

d' }
> > img.format =3D 'JPG'
> > send_data(imgl.to_blob, {:type =3D> 'image/jpeg', :disposition =3D>
> > 'inline'})
> > end
> >
> > end
> >
> > but I get this error in the browser:
> >
> > SystemStackError in GenerateController#img
> > stack level too deep
> >
> >
> > RAILS_ROOT: ./script/../config/..
> > Application Trace | Framework Trace |
> > Full
> > Trace
> > /devel/rtst/app/controllers/generate_controller.rb:13:in `img'
> > /devel/rtst/app/controllers/generate_controller.rb:13:in `img'
> >
> > Any ?
> >
> > On 1/8/08, Juan Mat=EDas <jmrepetti@gmail.com> wrote:
> > >
> > > It seems that you don't have building tools, try installing

> > ruby1.8-devand
> > > build-essential, libgraphicsmagick1-dev packages.
> > >
> > > Juan Matias
> > >
> > >
> > > On Jan 8, 2008 1:16 PM, macaco <macacoangel@gmail.com> wrote:
> > >
> > > > On Jan 5, 2008 4:30 PM, Bira <u.alberton@gmail.com> wrote:
> > > >
> > > > > On Jan 5, 2008 12:21 PM, macaco <macacoangel@gmail.com> wrote:
> > > > > > Hi, I'm new to this language, so any will be welcome.
> > > > > >
> > > > > > I'm trying to create images at random, not a problem with this,

> > and
> > > I
> > > > > can do
> > > > > > it on ruby alone saving the image to the filesystem and watchin=

g
> > it
> > > > > later on
> > > > > > a viewer.
> > > > > >
> > > > > > Buy when I try to use RoR, like creating the image on the fly,

> not
> > > > > saving it
> > > > > > to the filesystem, and presenting it on the browser.... well, i

> > get
> > > > > > confused. All I can do so far, it's to show the image i have
> > > > generated
> > > > > on
> > > > > > ruby before.
> > > > > >
> > > > > > btw, i'm using RMagick to do the trick.
> > > > > >
> > > > >
> > > > > You can probably use send_data in your controller for this.
> > > > >
> > > > >
> > > >
> > >

> >

> http://api.rubyonrails.org/classes/A...g.html#M00022=

9
> > > > >
> > > > >
> > > > >
> > > > Thanks, that was ing, but as I was having troubles with rmagic

> and
> > > > windows, i decided to switch to linux
> > > >
> > > > problem is, after i installed everything listed on
> > > > http://rmagick.rubyforge.org/install-linux.html, trought apt-get on
> > > > debian,
> > > > once I try to run the gem, this is what I get:
> > > >
> > > > *macaco@ig88:/devel/rtst$ sudo gem install rmagick -r
> > > > Building native extensions. This could take a while...
> > > > ERROR: While executing gem ...

> (Gem::Installer::ExtensionBuildError)
> > > > ERROR: Failed to build gem native extension.
> > > >
> > > > ruby extconf.rb install rmagick -r
> > > > extconf.rb:1:in `require': no such file to load -- mkmf (LoadError)
> > > > from extconf.rb:1
> > > >
> > > >
> > > > Gem files will remain installed in /var/lib/gems/1.8/gems/rmagick-
> > > 2.0.0for
> > > > inspection.
> > > > Results logged to /var/lib/gems/1.8/gems/rmagick-2.0.0
> > > > /ext/RMagick/gem_make.out*
> > > >
> > > > Any ?
> > > >
> > >
> > >
> > >
> > > --
> > > =ABQuien nunca ha cometido un error nunca ha probado algo nuevo.=BB
> > >

> >

>
>
>
> --
> =ABQuien nunca ha cometido un error nunca ha probado algo nuevo.=BB
>


  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 19h11.


Édité par : vBulletin® version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières ©2000-2008
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,27476 seconds with 16 queries