I've tried both solutions and it's not working here

   1) decode is giving me following error.

     27.0.0.1.2014-12-02.13-01-39.af379677-6327-4f4c-bc93-5ed1e5e02ed8
   <class 'binascii.Error'> Incorrect padding

  2) Second option is not working.

    I've printed image path but it didn't display on login page.

      <img
src="data:image/gif;base64,/default/show_logo/company.logo.91f2753b1fabaab6.736571756f69615f6361706974616c5f6c6f676f2e676966.gif"
/>



On Tue, Dec 2, 2014 at 12:44 PM, Mandar Vaze <mandarv...@gmail.com> wrote:

>
> http://stackoverflow.com/questions/16279856/converting-blob-stored-on-a-database-to-an-image-on-an-html-website
>
> On Tuesday, December 2, 2014 12:09:25 PM UTC+5:30, Prasad Muley wrote:
>
>> Hi All,
>>
>>        I need to display logo according to url in login page. I tried to
>> display the logo but it always shows *404 not found* error on login page.
>>
>> My app settings are below:
>>
>>
>> *models/db.py*
>>
>>
>> db.define_table('company',
>>                          Field('name', 'text', notnull=True),
>>                          Field('abbrev', 'string', length=32),
>>                          Field('logo', 'upload', uploadfield=True,
>>                                   requires=IS_IMAGE()),
>>                          Field('timezone', 'string',
>>                                   requires=IS_IN_SET(all_timezones)),
>>                          Field('url', 'string',
>>                                   requires=IS_URL()),
>>                          format='%(name)s')
>>
>>
>> *controllers/default.py*
>>
>> def user():
>>     """
>>     exposes:
>>     http://..../[app]/default/user/login
>>     http://..../[app]/default/user/logout
>>     http://..../[app]/default/user/register
>>     http://..../[app]/default/user/profile
>>     http://..../[app]/default/user/retrieve_password
>>     http://..../[app]/default/user/change_password
>>     http://..../[app]/default/user/manage_users (requires membership in
>>     use @auth.requires_login()
>>         @auth.requires_membership('group name')
>>         @auth.requires_permission('read','table name',record_id)
>>     to decorate functions that need access control
>>     """
>>     #set some default name
>>     abbrev_name = 'ASDF'
>>     company_rec = db(db.company.url.contains(request.env.http_host)).
>> select().first()
>>     if company_rec:
>>         abbrev = company_rec['abbrev']
>>         logo = IMG(_src = URL('default', 'show_logo',
>> company_rec['logo']))
>>         session.company_timezone = company_rec['timezone']
>>     return dict(form=auth(), abbrev=abbrev, logo=logo)
>>
>>
>> def show_logo():
>>     return response.download(request, db)
>>
>>
>> *views/default/user.html:*
>>
>> <html>
>> <head> .... </head>
>> <body>
>>        <div class="logo" style="display: inline-block;">
>>    <h2> {{=logo}} </h2>
>>            <h2>{{=abbrev}}</h2>
>>        </div>
>>
>> <!-- some code for login / log_out / change_password -->
>> </body>
>> </head>
>>
>>
>> It shows following error as:
>>
>>    1. Remote Address:
>>    127.0.0.1:8000
>>    2. Request URL:
>>    https://127.0.0.1:8000/default/show_logo/investor.
>>    logo.91f2753b1fabaab6.736571756f69615f6361706974616c
>>    5f6c6f676f2e676966.gif
>>    
>> <https://127.0.0.1:8000/default/show_logo/investor.logo.91f2753b1fabaab6.736571756f69615f6361706974616c5f6c6f676f2e676966.gif>
>>    3. Request Method:
>>    GET
>>    4. Status Code:
>>    404 NOT FOUND
>>
>>
>>
>> Is there any way to display blob image ?
>>
>>  --
> 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 a topic in the
> Google Groups "web2py-users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/web2py/FndDA_sXQto/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Thanks and Regards
Prasad M. Muley
Programmer at One Delta Synergies Pvt Ltd. | PICT 2013

“Pretty much everything on the web uses those two things: *C* and *UNIX*,”
- Dennis Ritchie
                               *http://www.cs.bell-labs.com/who/dmr/*
<http://www.cs.bell-labs.com/who/dmr/>

-- 
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/d/optout.

Reply via email to