Saturday, September 15, 2012

Image Upload feature added to Lampcms

My Question on Support site for LampCMS project




As you can see, this image has been added using the new uploadfeature.
Now you can upload an image instead of just providing a path to image on the Internet

Image is automatically resized if uploaded image is larger than maximum dimensions defined in config.
If image is resized then resized image will also link to original image which will open in a new window.
Later we can add option to .js file to open original in some type of lightbox.

Default max dimensions are 400 width by 300 height, but you can change these on your site.

This new feature is available on github in the YUIUploader branch and is also included in the official .zip file which can be downloaded from the http://www.lampcms.com/download/ page

There are several configuration options added to !config.ini.dist and also a new permission is added to acl.ini.dist

What you need to do is add this permission to [registered] group in your acl.ini file
upload_image = A

Some new config settings added to [EDITOR] section of !config.ini:

;
; Maximum file size allowed for imageupload
; in megabytes default is 2 meaning 2 Megabytes
;
; To disable imageupload functionality
; set this to 0 or leave empty
;
IMAGE_UPLOAD_FILE_SIZE = 2
;
; Define maximum width,height (comma separated)
; If uploaded image is larger than these limits,
; it will be resized
;
IMAGE_UPLOAD_W_X = "300,200"

;
; Uploads are allowed by logged in users
; Set the min reputation score required to be
; able to upload images
IMAGE_UPLOAD_MIN_REPUTATION = 1
;
; Number of seconds user has to wait between uploads
; Resizing image is CPU and memory intensive.
; This setting helps prevent upload flood
;
MIN_UPLOAD_INTERVAL = 30

This is an initial release of imageuploadfeature. What currently does not work is imageupload in the "Edit" Question or Answer action, it only works during Ask/Answer action

I will add it to Edit soon, it's a bit tricky because what I want to do is when image is removed from the post when post is edited I want to also delete image from the server.

Anyway, it took alot of work to add this seemingly small feature.

Enjoy.

Click here to post your reply


No comments:

Post a Comment