Advertisement:

Author Topic: image uploader  (Read 1335 times)

Pigeon

  • Sr. Member
  • ****
  • Posts: 498
image uploader
« on: January 25, 2016, 05:43:20 am »
Hi,
osclass.3.5.2
theme: modern

is there a good plugin for image uploader?
except this one, "github.com/garciademarina/osclass-image-upload", becuase i tried but it did not work with my version of osclass

Thank You




teseo

  • Hero Member
  • *****
  • Posts: 6169
Re: image uploader
« Reply #1 on: January 25, 2016, 01:36:34 pm »
Hi,

Just upgrade your Modern theme to latest v. 5.1.0, it already includes this feature.

Regards

Pigeon

  • Sr. Member
  • ****
  • Posts: 498
Re: image uploader
« Reply #2 on: January 29, 2016, 09:10:07 am »
Hi,

Just upgrade your Modern theme to latest v. 5.1.0, it already includes this feature.

Regards

Teseo,
i can NOT upgrade, because i edited my theme a lot,
can i take (image-uploader) part from new version and replace it in my theme (osclass.3.5.2 / modern theme 3.0.3)?
Regards

teseo

  • Hero Member
  • *****
  • Posts: 6169
Re: image uploader
« Reply #3 on: January 29, 2016, 01:35:46 pm »
Let's see if this works. Make sure you backup the files first and follow the instructions carefully, so no undesirable syntax errors.

1.- Add this at the very bottom of your theme functions.php:
Notes:
1.- Take care not to leave blank lines after this.
2.- If your theme functions.php doesn't end with ?> skip first line of my code.

Code: [Select]
<?php
if (modern_is_fineuploader()) {
    if (!
OC_ADMIN) {
        
osc_enqueue_style('fine-uploader-css'osc_assets_url('js/fineuploader/fineuploader.css'));
    }
    
osc_enqueue_script('jquery-fineuploader');
}

function 
modern_is_fineuploader() {
    return 
Scripts::newInstance()->registered['jquery-fineuploader'] && method_exists('ItemForm''ajax_photos');
}
?>


2.- item-edit.php:

Replace this line:

Code: [Select]
<?php if(osc_images_enabled_at_items()) ItemForm::photos_javascript(); ?>

with:

Code: [Select]
        <?php if(osc_images_enabled_at_items() && !modern_is_fineuploader()) {
            
ItemForm::photos_javascript();
        } 
?>


3.- item-post.php and item-edit.php:

Replace this:

Code: [Select]
                    <?php if( osc_images_enabled_at_items() ) { ?>
                    <div class="box photos">
                        <h2><?php _e('Photos''modern'); ?></h2>
                        <div id="photos">
                            <div class="row">
                                <input type="file" name="photos[]" />
                            </div>
                        </div>
                        <a href="#" onclick="addNewPhoto(); uniform_input_file(); return false;"><?php _e('Add new photo''modern'); ?></a>
                    </div>
                    <?php ?>

with:

Code: [Select]
            <?php if( osc_images_enabled_at_items() ) { ?>
            <div class="box photos">
                <?php if(modern_is_fineuploader()) {
                    
// new ajax photo upload
                    
ItemForm::ajax_photos();
                } else { 
?>

                <h2><?php _e('Photos''modern'); ?></h2>
                <div id="photos">
                    <div class="row">
                        <input type="file" name="photos[]" />
                    </div>
                </div>
                <a href="#" onclick="addNewPhoto(); uniform_input_file(); return false;"><?php _e('Add new photo''modern'); ?></a>
            </div>
                <?php }
            } 
?>



Pigeon

  • Sr. Member
  • ****
  • Posts: 498
Re: image uploader
« Reply #4 on: January 30, 2016, 10:21:08 am »
Thank you very much Teseo
yeah that's nice, i really appreciate it.
actually i just wanted to do this way to solve one of my problems but it did NOT fixed it, the problem is: i don't have a mobile version in my osclass, because i removed mobile version before because of some reasons. and when i open my website with mobile android phone, and want to upload the photo, selecting photo from memory card is okay but when i want to take (capturing) a photo, it gives me error (Unable to complete previous operation due to low memory) with both chrome and other browser,.
but after changing the code to your photo uploader, its working fine but the problem did NOT solve, still the same error, but thank you very much its a good photo uploader.
regards