Username
Forgot password?
Welcome to our site!
Or Join with FTTF

Image Upload feature added to Lampcms

1

727 views



As you can see, this image has been added using the new upload feature.
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 image upload
; in megabytes default is 2 meaning 2 Megabytes
;
; To disable image upload 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 image upload feature. What currently does not work is image upload 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.

 
asked September 15, 2012 at 7:26 PM

 us

1 Answer

0
 
Awesome! Me likes. The lightbox thing will be really cool.

Btw, I wanted to add this as a comment, but my reputation did not allow me to.
flag
answered September 15, 2012 at 10:07 PM

Your answer

Join with account you already have

FTTF

Preview

Alert