[web2py] Re: how show images from side sites?

2013-11-05 Thread Copper Lark


воскресенье, 3 ноября 2013 г., 18:30:12 UTC+4 пользователь Anthony написал:

 {{ = XML('img src=%s' % 'https://some_url/image01.jpg') ) }}


 The above code is fine, except there is an extra ) at the end. Another 
 option is to use the IMG helper:

 {{=IMG(_src='https://some_url/image01.jpg')}}

 https://money.yandex.ru/i/shop/mosenergosbut.gif


 If you are wondering why the above image in particular doesn't show up 
 when you attempt to display it with an img tag, they are probably using 
 some mechanism to prevent 
 hotlinkinghttp://simple.wikipedia.org/wiki/Hotlinking(e.g., they check the 
 HTTP_REFERER header and return a 302 not found error 
 when external sites attempt to load the image). If you want to display the 
 image (and doing so is not prohibited by copyright), you will have to 
 download the image and serve it yourself.

 Anthony 

  
if I load they site by urllib2.urlopen(url)
 - how then load IMAGE to web2py DB?

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: how show images from side sites?

2013-11-03 Thread Anthony


 {{ = XML('img src=%s' % 'https://some_url/image01.jpg') ) }}


The above code is fine, except there is an extra ) at the end. Another 
option is to use the IMG helper:

{{=IMG(_src='https://some_url/image01.jpg')}}

https://money.yandex.ru/i/shop/mosenergosbut.gif


If you are wondering why the above image in particular doesn't show up when 
you attempt to display it with an img tag, they are probably using some 
mechanism to prevent 
hotlinkinghttp://simple.wikipedia.org/wiki/Hotlinking(e.g., they check the 
HTTP_REFERER header and return a 302 not found error 
when external sites attempt to load the image). If you want to display the 
image (and doing so is not prohibited by copyright), you will have to 
download the image and serve it yourself.

Anthony 

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.