[Plugin: Comment Images] Size limit
-
Great plugin! Is there a way to set a limit on the size of the images uploaded?
The limit would be either dimensions or file size.
Thanks!
-
Thanks!
Currently there is no way to set a limit on the size of the images being uploaded. I’ll make a note of this and see about adding something like this in a future version.
I was having this problem also and changing the css for the plugin didn’t work (noticed it was inactive after messing with it). I simply went in to my themes css and inserted the following code and it works great.
/******************************************
Comment Image Picture Control
******************************************/
.comment-image img {
max-width: 400px;
}Of course just set the max-width to whatever looks good on your site. I hope this helps.
Thanks for sharing this. In the next version of the plugin, I plan to have this resolved.
Very nice idea. But the best feature should be a resize of the uploaded image so the page will not be too heavy to load.
Noted – will see what I can do in a future version!
Thanks for the suggestion!
Awesome, thanks for this short term fix. Looking forward to the updated version of a great plugin.
Would also just like to second (or third or whatever) the motion to be able to auto downsize images so they fit the area. Would gladly purchase a reliable supported comment image upload plugin.
Another awesome feature would be a lightbox type thing so double clicking a thumbnail image would expand it in pop up window.
Breadtopia,
I hear you loud and clear!
I always appreciate the feedback and I’m aiming to have these features baked in as soon as I can get some time.
Also, I appreciate the thought on paying for a premium version of the plugin. That’s something I’ll definitely consider.
Love all the feedback – keep it coming!
Sounds good. Just having a receptive developer is a bonus!
I’ve been through a few comment image plugins that either aren’t quite good enough and/or no longer supported. Such a plugin is invaluable for our site so I’m surprised there there doesn’t seem to be more demand for it.
Since the beginning I’ve had to use a programmer to add code or whatever to get them to do what I want. Having just discovered yours, they are working on it as I type. Hopefully they’ll also get it to pull in all the previously uploaded images from the now defunct plugin I was using.
Completely understand.
I’d love for this to be the de-facto Comment Images plugin, but I’ve just gotta find the time to work in these feature requests.
Believe me: I’m just as impatient as you guys when it comes to want it done ;). Just have a backlog of some other stuff for the time being.
Just thought I’d “bump” this thread… I could use the image re-sample function.
Thanks for great work!Thanks gnickoloff!
This hasn’t been forgotten – just haven’t had a chance to work on the plugin lately.
For those that are curious, this is likely how the plugin will work:
- On each post’s page, you’ll set a maximum size for the image (in MB)
- The comment form will display a note, if there is a limit
- If the image uploaded is greater than the size specified, then the user will be given a warning and the image will fail to load
Hope this clarifies where things are heading (at least in the future :).
Haven’t had time in ten months? You’ve got a very popular plugin man, at least stick it on Git and request a fork.
The plugin hasn’t not been updated; however, this is one feature I just haven’t gotten to implementing yet.
Good to know. I can get it to die if I do a file check but it does an ugly die and then posts the comments with the image stripped anyway. It’s sub-optimal. I can remove the else and it posts the comment but silently strips the image.
// If the nonce is valid and the user uploaded an image that is less than 150kb, let's upload it to the server if( isset( $_FILES[ $comment_image_id ] ) && ! empty( $_FILES[ $comment_image_id ] ) ) { if ( $_FILES[ $comment_image_id ]['size'] < 153600 ) { // Store the parts of the file name into an array $file_name_parts = explode( '.', $_FILES[ $comment_image_id ]['name'] ); // If the file is valid, upload the image, and store the path in the comment meta if( $this->is_valid_file_type( $file_name_parts[ count( $file_name_parts ) - 1 ] ) ) {; // Upload the comment image to the uploads directory $comment_image_file = wp_upload_bits( $_FILES[ $comment_image_id ]['name'], null, file_get_contents( $_FILES[ $comment_image_id ]['tmp_name'] ) ); // Now, we need to actually create a post so that this shows up in the media uploader $img_url = media_sideload_image( $comment_image_file['url'], $post_id ); // And strip out the name of the image file so we can save this to the meta data // Regex is usually bad for this, but WordPress is predictable in the format preg_match_all( "#[^<img src='](.*)[^'alt='' />]#", $img_url, $matches ); $comment_image_file['url'] = $matches[0][0]; // Set post meta about this image. Need the comment ID and need the path. if( false == $comment_image_file['error'] ) { // Since we've already added the key for this, we'll just update it with the file. add_comment_meta( $comment_id, 'comment_image', $comment_image_file ); } // end if/else } // end if } else { die; } }
- The topic ‘[Plugin: Comment Images] Size limit’ is closed to new replies.