Hi All,
      I am writing an image gallery in my app. I am stuck up here -
I want to display images that belong to a particular album when I select 
that album in the view. Although I am able to display albums in the view, 
but cannot proceed further to display images belonging to that particular 
albums after clicking the album (from the view).  

here are the table in *db.py* - 
db.define_table('photoalbum',
    Field('reguser_id'),
    Field('album_name'),
    Field('short_description'),
    )

db.define_table(photos',
    Field('reguser_id'),
    Field('caption'),
    Field('category', requires=IS_IN_SET(pix_cat)),
    Field('description', 'text'),
    Field('upload_photo', 'upload' , uploadfolder=request.folder + 'static/
uploads', default=0,  autodelete=True,), 
    Field('album_name', requires=IS_IN_SET(albums)),
    )



Controller - *default.py *

def myalbums():
    
    ## selects all albums
    allalbums = db(db.photoalbum.reguser_id == session.logged_in_user_id). 
select(db.photoalbum.album_name)
    
    # selects descriptions for all albums 
    alldescriptions = db(db.photoalbum.reguser_id == session.
logged_in_user_id). select(db.photoalbum.short_description)
    
    ## selects photos
    allimages = db(db.photos.reguser_id == session.logged_in_user_id). 
select(db.photos.upload_photo, db.photos.caption, db.photos.description, 
cache=(cache.ram,20))
    
    return dict(allalbums=allalbums, alldescriptions=alldescriptions, 
allimages=allimages) 


Code in the view *myalbum.html*
<!-- New Try -->

{{for i in range(len(allalbums)):}}        
        
        <ul class="thumbnails">
        <!-- Iterate over all images - --> 
        <li class="span2">
        <div class="thumbnail">
        <!-- <img data-src="holder.js/300x200" alt="300x200" style="">   -->
                
        {{=(A(IMG(_src=URL(r=request,c='static\images',f='vimage.jpg')),
_href=URL (r=request,c='default', f='myalbums', args=[allalbums[i].
album_name]) ))}}
            
        
        <div class="caption">        
        <h5>{{=allalbums[i].album_name}}</h5>
        <p>{{=alldescriptions[i].short_description}}</p>
        
        
        </div>
        
        </div>
        </li>
           
           {{pass}}    
           {{pass}}  


Here I can get the album names in the view but when I click on it, it 
should query all the photos belonging to that particular (as specified in 
args) albumname and show all images in another page or a carousel that I 
would create. 

Again - The image vimage.jpg specified in the view is a static image, can 
the thumbnail image representing a particular album be created from an 
image from within the album ? Please suggest ..


Thanks , Rahul 

-- 
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