I very much welcome more italians to the fold of web2py-users, but this group is in English
Translation: Apprezzo l'entrata di altri italiani nel gruppo, ma questo (web2py-users) è in inglese ! @AleLeonetti: to keep images at 50% scale, it'd be better to have them resized properly. If you know beforehand the size (height and width) you should use those as attributes to the img tag. If you don't know beforehand, there are other ways, but not so direct (http://stackoverflow.com/questions/11117602/image-re-size-to-50-of-original-size-in-html). PDFs previews are "not a thing" unless you play with external javascript libraries or flash components. A link to download a file stored into the database is easy to generate, assuming your table is something like db.define_table('Candidature', .... Field('Allegato', 'upload')) . Just fetch the proper db.Canditature record, such as download_file = db(db.Candidature.id == 1).select().first() and you can generate the url via the standard download function URL('default', 'download', args=download_file.Allegato) On Saturday, January 2, 2016 at 5:32:43 PM UTC+1, Alessio Varalta wrote: > > Per visualizzarlo potresti fare un windows.open(url per scaricare il file) > in questo modo ti apre una pagina con il pdf questo è > javascript(all'interno della pagina non lo so) per il downlod invece > dovresti chiamare via javascript un windows.open che chiama una funzione > controller che ritorna un response.stream(guarda guida che conterrà url > dove sta il file) e specifica il tipo di ritorno response.content-type=pdf > quindi guardati response.stream per lo scaricare > > On Saturday, 2 January 2016 15:12:44 UTC+1, Alessandro Leonetti wrote: >> >> Buongiorno e Buon 2016 a tutti gli utenti del forum! >> >> Mi trovo in difficoltà su un paio di view che devo realizzare per le mie >> pagine. >> In particolare vorrei chiedere che codice devo utilizzare per >> visualizzare nella pagina un file PDF, o una sua anteprima, o anche solo >> un'icona che permetta il download del file al quale punta nel database. >> >> Nel caso specifico devo utilizzare il file contenuto in >> db.Candidature.Allegato. >> >> Per la visualizzazione delle immagini invece sto utilizzando questo >> codice: >> >> <p> >> <h3> >> Allegato JPG >> </h3> >> <img src ="{{=URL('default', 'download', >> args=post.Allegato_JPG)}}" height="250" width="250"> >> </p> >> >> è possibile impostare la visualizzazione in modo che visualizzi >> l'immagine ridotta del 50% sulle dimensioni originali? >> >> Grazie per l'aiuto!! >> >> Cordiali Saluti, >> Alessandro >> > -- 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 [email protected]. For more options, visit https://groups.google.com/d/optout.

