unable to display image from local directory

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

unable to display image from local directory

Sanjay Minni
Hi

I am unable to display an image from a local directory using

    html image url: 'myimage.gif'
    (where myimage.gif is stored in the same directory as the pharo image),

but it works fine if I point to the image with  complete URL on the new say
    html image url: 'http://www.mysite.com/myimage.gif'

so how can I pick up from the local directory

regards
Sanjay
 
cheers,
Sanjay
Reply | Threaded
Open this post in threaded view
|

Re: unable to display image from local directory

jtuchel
Sanjay,

Pharo doesn't serve files from the local file system by default. There
are specialised subclasses of WAFileLibrary (or at least you could build
one) to do that. What you do is send an img tag down to the browser that
contains a src="myimage.gif" attribute. The browser then has to fetch
this image from the web server, in your case the Pharo image and Seaside...

There are several options:

1) as I mentioned before, add a FileLibrary to your application that can
serve local files (you'd have to send urlOf: to the FileLibrary class to
send the correct src attribute)
2) use an url of a web server that server files, like html image url:
'Mydropbox.com/myimage.gif'
3) Import your image into a WAFileLibrary subclass so that it has a
method that holds a ByteArray of the contents of this image. Then you
can server the image from within Pharo

HTH,

Joachim



Am 25.01.15 um 16:37 schrieb Sanjay Minni:

> Hi
>
> I am unable to display an image from a local directory using
>
>      html image url: 'myimage.gif'
>      (where myimage.gif is stored in the same directory as the pharo image),
>
> but it works fine if I point to the image with  complete URL on the new say
>      html image url: 'http://www.mysite.com/myimage.gif'
>
> so how can I pick up from the local directory
>
> regards
> Sanjay
>  
>
>
>
> -----
> ---
> Regards, Sanjay
> --
> View this message in context: http://forum.world.st/unable-to-display-image-from-local-directory-tp4801549.html
> Sent from the Seaside General mailing list archive at Nabble.com.
> _______________________________________________
> seaside mailing list
> [hidden email]
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>


--
-----------------------------------------------------------------------
Objektfabrik Joachim Tuchel          mailto:[hidden email]
Fliederweg 1                         http://www.objektfabrik.de
D-71640 Ludwigsburg                  http://joachimtuchel.wordpress.com
Telefon: +49 7141 56 10 86 0         Fax: +49 7141 56 10 86 1

_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: unable to display image from local directory

Sanjay Minni
thanks Joachim

since its lightweight and very static I have got thru with method 3 above (WAFileLibrary subclass>>method)

regards
Sanjay
cheers,
Sanjay
Reply | Threaded
Open this post in threaded view
|

Re: unable to display image from local directory

Johan Brichau-2
You can also load Seaside-FileSystem and serve files directly from the disk.

(ConfigurationOfSeaside3 project version: #stable) load: #(‘Filesystem’)

Use the configuration interface to create a ‘File directory’ handler to serve the files from disk directly.

Note: only advised to do this in development since this pulls files through the image. For production, use an external front-end webserver like apache or nginx.

Johan

 

> On 26 Jan 2015, at 05:34, Sanjay Minni <[hidden email]> wrote:
>
> thanks Joachim
>
> since its lightweight and very static I have got thru with method 3 above
> (WAFileLibrary subclass>>method)
>
> regards
> Sanjay
>
>
>
>
> -----
> ---
> Regards, Sanjay
> --
> View this message in context: http://forum.world.st/unable-to-display-image-from-local-directory-tp4801549p4801628.html
> Sent from the Seaside General mailing list archive at Nabble.com.
> _______________________________________________
> seaside mailing list
> [hidden email]
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside

_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside