Showing posts with label upload. Show all posts
Showing posts with label upload. Show all posts

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


Saturday, September 8, 2012

Image upload for Questions and Answers

My Question on Support site for LampCMS project

Just want to post a little update on the imageupload functionality

I am currently working on adding imageupload functionality to the text editor.
I am using this plugin to YUI RTE as a starting point:
http://allmybrain.com/2010/06/16/yui-image-uploader-works-with-yui-2-8-1/

It's a good start, I have already made changes to JavaScript to make it work with YUI3 based functions.
Now I'm working on the server-side functionality.

It's not a difficult task but there are just a lot of little things I have to implement on the server.
Here is the list:

Only logged-in users will be able to upload images
Uploading of image will be a separate Access permission, configurable in the acl.ini, by default will be enabled for registered users
A configuration option will be used to require minimum reputation in order to allow imageupload
Configuration options for imageupload: max file size, max width and max height.
Image will be resized to fix max width and height. If image had to be resized then the original is also saved separately so that later we can have option to view the original
If user does not have permission or enough reputation to uploadimage then the imageupload button will not even be added to the text editor. Additionally the same permissions/reputation will be checked on the server after image is uploaded just to be sure...
Extra check will be in place to prevent more than "N' uploads per minute. This is to prevent attempts to overload the server by uploading hundreds of images rapidly.

As you can see there are quite a few functions I have to implement and test. It's not very difficult but it will take time, so please be patient - the imageupload functionality is coming... I would estimate to take about 4 more days. I mean working days, and since I work on Lampcms only on weekends it may take up to 4 more weeks.


Click here to post your reply