Luistxo Fernandez
Fri, 06 May 2005 05:53:26 -0700
* Image addition and management: pictures get embedded into posts. This feature is based on the work of Jeff Hicks, Brady Davis and friends at Blogplot.com
Regarding this last feature, see how it works in our demo, http://www.datamina.net/blogak/csblog-en/1 or in sites related to the Blogplot crew, the inventors of it, http://blogplot.com/40 http://jrhicks.net/84
1. In "Entry.py" add these lines near the top for easy access to change. Note I have upped the size to 100k due to user complaints. Whats 10k going to hurt anyway? :)
Start code --->
#Statics MAXIMAGESIZE = 100000 MAXIMAGESIZEMSG = '<h2><font color="red">Maximum Image Size Exceeded. Please resize and compress your images to under 100 kb.</font></h2>'
End code ---->
2. Also in "Entry.py", update "manage_addImageScript()" to the following:
Start Code --->
security.declareProtected(AddCOREBlogEntries, 'manage_addImageScript') def manage_addImageScript(self): context = self if context.REQUEST.has_key('pic1'): file = context.REQUEST['pic1'] filelength = len(file.read()) if filelength > MAXIMAGESIZE: return MAXIMAGESIZEMSG
name = context.ZopeTime().strftime('img_%b_%d_%Y_%M_%S')
file.seek(0)
context.manage_addProduct['Photo'].manage_addPhoto(name,name,file,engine='PIL',quality=90)
photo = getattr(context,name) for property in
['placement','border','display_size','zoom','caption']:
photo.manage_addProperty(property,
context.REQUEST[property], 'string') if context.REQUEST.has_key('deletebox'):
ids = context.REQUEST['deletebox']
context.manage_delObjects(ids)return ''
End Code --->
That should do it. Credit goes to: Brady Davis http://conversationswithmyself.com Jeff Hicks http://jrhicks.net
_______________________________________________ COREblog-en mailing list COREblog-en@postaria.com http://postaria.com/cgi-bin/mailman/listinfo/coreblog-en Unsubscription writing to [EMAIL PROTECTED]