def _list_thumbnail(view, context, model, file): if not model.file: return '' print os.path.join(THUMBNAIL_FOLDER, form.thumbgen_filename(model.file)) return Markup('<img src="%s"><span style="margin-left:10px">%s</span>' % (url_for('static', filename=IMAGE_FOLDER + "/" + form.thumbgen_filename( model.file)) , model.file))
def _list_thumbnail(view, context, model, name): #如果没有图片显示缩略图 if not model.thumbnail: return Markup('<img src="%s">' % url_for('static', filename="uploads/admin/thumbnail/" + form.thumbgen_filename('111'))) return Markup('<img src="%s">' % url_for('static', filename="uploads/admin/thumbnail/" + form.thumbgen_filename(model.thumbnail)))
def _list_thumbnail(view, context, model, name): if not model.name: return '' print os.path.join(THUMBNAIL_FOLDER, form.thumbgen_filename(model.name)) return Markup( '<img src="%s"><span style="margin-left:10px">%s</span>' % (url_for('static', filename=IMAGE_FOLDER + "/" + THUMBNAIL_FOLDER + "/" + form.thumbgen_filename(model.name)), model.name))
def _list_thumbnail(view, context, model, name): if not model.image: return '' return Markup( '<img src="%s">' % url_for('static', filename='uploads/' + form.thumbgen_filename(model.image)))
def _list_thumbnail(view, context, model, name): if not model.head_img: return '' return Markup( '<img src="%s">' % url_for('static', filename=form.thumbgen_filename(model.head_img)))
def _list_thumbnail(view, context, model, name): if not model.path: return '' return Markup('<img src="{}">'.format( url_for('static', filename='img/' + form.thumbgen_filename(model.path))))
def _list_thumbnail(view, context, model, name): if not model.path: return '' return Markup('<img src="%s">' % url_for( 'static', filename=op.join('img/', form.thumbgen_filename(model.path))))
def _list_thumbnail(view, context, model, name): if not model.path: return "" return Markup( '<img src="%s">' % url_for("static", filename=form.thumbgen_filename(model.path)))
def _list_thumbnail(view, context, model, name): if model.remote_url: return Markup('<img src="%s">' % model.remote_url) return Markup( '<img src="%s">' % url_for('static', filename=form.thumbgen_filename(model.pic_url)))
def _list_thumbnail(view, context, model, name): if not model.imagefile: return '' # This is a horrible kludge! full_filename = "img/" + form.thumbgen_filename(model.imagefile) return Markup('<img src="%s">' % url_for('static', filename=full_filename))
def _list_thumbnail(view, context, model, name): if model.path: return Markup('<img src="%s">' % url_for('static', filename='uploaded/{}'.format( form.thumbgen_filename(model.path)))) else: return ''
def show_thumbnail(view, context, model, name): if not model.path: return "" pic_path = url_for('static', filename=form.thumbgen_filename(model.path)) return Markup("<img src='{}'>".format(pic_path))
def _list_thumbnail(view, context, model, name): if not model.path: return '' prefix = 'img/uploads/' return Markup( '<img src="%s">' % url_for('static', filename=thumbgen_filename(prefix + model.path)))
def _list_thumbnail(self, view, model, name): print(model.imagepath) if not model.imagepath: return '' return Markup( '<img src="%s">' % url_for('static', filename=form.thumbgen_filename('img/' + model.imagepath)))
def _list_thumbnail(view, context, model, name): if not model.path: return '' return Markup( '<img src="%s">' % url_for('static', filename=form.thumbgen_filename(model.path)) )
def del_image(mapper, connection, target): if target.header_img: try: os.remove(os.path.join(current_app.config['UPLOAD_FOLDER']+'headers/', target.header_img)) except OSError: pass try: os.remove(os.path.join(current_app.config['UPLOAD_FOLDER']+'headers/', form.thumbgen_filename(target.header_img))) except OSError: pass
def _list_thumbnail(self, context, model, name): if not model.avatar: return Markup( '<img src="%s">' % url_for("static", filename="images/default_thumb.png")) return Markup( '<img src="%s">' % url_for("static", filename="images/" + form.thumbgen_filename(model.avatar)))
def _list_thumbnail(instance, context, model, name): if not model.path: return '' return Markup( '<img src="%s" width="100">' % url_for( 'quokka.core.media', filename=form.thumbgen_filename(model.path) ) )
def _list_thumbnail(instance, context, model, name): if not model.path: return '' return Markup( '<img src="%s" width="100">' % url_for( 'flaskpress.core.media', filename=form.thumbgen_filename(model.path) ) )
def after_model_delete(self, model): if model.path: try: os.remove(op.join(file_path, model.path)) except OSError: pass try: os.remove( op.join(file_path, form.thumbgen_filename(model.path))) except OSError: pass
def product_image_formatter(_view, _context, model, _name): """ Displays a thumbnail of a products image in the admin orders page. """ if not model.image: return 'No Image Available' return Markup('<img src="{0}">'.format( url_for('static', filename=form.thumbgen_filename('images/' + model.image))))
def delete_image(mapper, connection, target): image_location = image_dir + target.imagefile thumb_location = image_dir + form.thumbgen_filename(target.imagefile) try: os.remove(image_location) except OSError: pass try: os.remove(thumb_location) except OSError: pass
def _list_thumbnail(view, context, model, name): res_templ = '<a class="btn btn-default" href="{}" role="button">Plausible Tag</a>' res = res_templ.format(url_for('.plausible_tag_view', id=model.id)) res_templ = '<a class="btn btn-default" href="{}" role="button">Top Tag</a>' res += res_templ.format(url_for('.top_tag_view', id=model.id)) res += '<br/>' if not model.path: return Markup(res) res += '<img src="%s">' % url_for( 'file', filename=form.thumbgen_filename(model.path)) return Markup(res)
def del_image(mapper, connection, target): if target.path: try: os.remove(op.join(file_path, target.path)) except OSError: pass try: os.remove(op.join(file_path, form.thumbgen_filename(target.path))) except OSError: pass
def del_prof(mapper, connection, target): if target.path: try: os.remove(op.join(prof_path, target.path)) except OSError: pass # Delete thumbnail try: os.remove(op.join(prof_path, form.thumbgen_filename(target.path))) except OSError: pass
def _list_thumbnail(view, context, model, name): btn_templ = '<a class="btn btn-default" href="{}" role="button">{}</a>' pt_button = btn_templ.format( url_for('.plausible_tag_view', id=model.id), 'Plausible Tag') tt_button = btn_templ.format(url_for('.top_tag_view', id=model.id), 'Top Tag') img_figure = '<figure><img src="{}"><figcaption>{}</figcaption></figure>'.format( url_for('file', filename=form.thumbgen_filename(model.path)), model.checksum.value[:7]) res = '<div>{}</div><div>{}{}</div>'.format(img_figure, pt_button, tt_button) return Markup(res)
def del_image(mapper, connection, target): if target.image: # Delete image try: os.remove(os.path.join(file_path, target.image)) except OSError: pass # Delete thumbnail try: os.remove(os.path.join(file_path, thumbgen_filename(target.image))) except OSError: pass
def _list_thumbnail(view, context, model, name): if not model.image: return '' if model.image: return Markup('<img src="{image}" style="width:100px;">'.format( image=model.image)) return Markup('<img src="%s">' % url_for( 'static', filename='images/thumbs/' + form.thumbgen_filename(model.image)))
def del_image(mapper, connection, target): if target.foto_ikan: # Delete image try: os.remove(op.join(file_path, target.path)) except OSError: pass # Delete thumbnail try: os.remove(op.join(file_path, form.thumbgen_filename(target.path))) except OSError: pass
def del_image(mapper, connection, model_obj): if model_obj.img: try: os.remove(os.path.join(file_path, model_obj.img)) except OSError: pass try: os.remove(os.path.join( file_path, form.thumbgen_filename(model_obj.img))) except OSError: pass
def del_image(mapper, connection, target): if target.path: # Delete image try: os.remove(os.path.join(file_path, target.path)) except OSError: pass # Delete thumbnail try: os.remove(os.path.join(file_path, form.thumbgen_filename(target.path))) except OSError: pass
def del_image(mapper, connection, target): img_path = op.join(basedir, 'app/static/img') if target.path: # Delete image try: os.remove(op.join(img_path, target.path)) except OSError: pass # Delete thumbnail try: os.remove(op.join(img_path, form.thumbgen_filename(target.path))) except OSError: pass
def image_icon_html(model, count=None): if not model.photo: return '' num_worker = '' if count: num_worker = '<i class="glyphicon glyphicon-user">x%s</i>' % str(count) html = '<a href="%s"><img src="%s" width="50" height="50">%s</a>' % ( url_for( 'order.edit_view', id=model.id, url=url_for('order.index_view')), url_for('static', filename=thumbgen_filename(model.photo)), num_worker) return html
def save_image(self, file): secured_filename_with_ext = secure_filename(file.filename) image_url = os.path.join(app.config["UPLOAD_FOLDER"], secured_filename_with_ext) thumbnail_url = os.path.join( app.config["UPLOAD_FOLDER"], form.thumbgen_filename(secured_filename_with_ext), ) file.save(image_url) image = Image.open(file) image = image.convert("RGB") image.thumbnail(app.config["THUMBNAIL_SIZE"], Image.ANTIALIAS) image.save(os.path.abspath(thumbnail_url)) return image_url, thumbnail_url
def del_image(mapper, connection, target): if target.path: # Delete image try: os.remove(op.join(setting.FILE_PATH, target.path)) except OSError: pass # Delete thumbnail try: os.remove(op.join(setting.FILE_PATH, form.thumbgen_filename(target.path))) except OSError: pass
def _list_thumbnail(view, context, model, name): if not model.path: return '' prefix = 'img/uploads/' return Markup('<img src="%s">' % url_for('static', filename=thumbgen_filename(prefix + model.path)))
def _list_thumbnail(view, context, model, name): if not model.path: return '' img_thumb = form.thumbgen_filename(model.path).replace('_thumb', '') imgpath = url_for('static', filename=img_thumb) return Markup('<img width="100" height="100" src="%s">' % imgpath)
def _list_thumbnail(view, context, model, name): if not model.path: return '' url='/static/upload/' + form.thumbgen_filename(model.path) return Markup('<a href="{}" target="_blank"><img src="{}"></a>'.format(url, url))
def list_thumbnail(view, context, model, name): if not model.name: return '' url = url_for('static', filename='files/' + model.path) url_thumb = url_for('static', filename='files/' + form.thumbgen_filename(model.path)) return Markup('<a href="%s" target="_blank"><img src="%s" width="100" height="100"></a>' % (url, url_thumb))
def _list_thumbnail(view, context, model, name): if model.path: return Markup('<img src="%s">' % url_for('static', filename='uploaded/{}'.format(form.thumbgen_filename(model.path)))) else: return ''
def get_image(self, obj): return '%s' % url_for('static', filename=form.thumbgen_filename(obj.main_image))
def thumb(self): return form.thumbgen_filename(self.path)
def _list_thumbnail(view, context, model, name): if not model.qrcode: return "" return Markup('<img src="%s">' % url_for("static", filename=form.thumbgen_filename(model.qrcode)))
def _list_thumbnail(view, context, model, name): if not model.image_path: return '' # print url_for('static',filename = form.thumbgen_filename(model.image_path)) path = '../../'+form.thumbgen_filename(model.image_path) return Markup('<img src="%s">' % path)