compress / compress image after upload on my site

-1

My site is overloading on large images uploads from users, I would like you to help me complement the code to compress and reduce the size of the image below the code below:

<div class="col-md-12 page-content">
                    <div class="inner-box category-content">
                        <h2 class="title-2"><strong> <i class="icon-camera-1"></i> {{ t('Photos') }}</strong></h2>
                        <div class="row">
                            <div class="col-sm-12">
                                <form class="form-horizontal" id="postForm" method="POST" action="{{ url()->current() }}" enctype="multipart/form-data">
                                    {!! csrf_field() !!}
                                    <input type="hidden" name="post_id" value="{{ $post->id }}">
                                    <fieldset>
                                        @if (isset($picturesLimit) and is_numeric($picturesLimit) and $picturesLimit > 0)
                                            <!-- Pictures -->
                                            <div id="picturesBloc" class="form-group <?php echo (isset($errors) and $errors->has('pictures')) ? 'has-error' : ''; ?>">
                                                <label class="col-md-3 control-label" for="pictures"> {{ t('Pictures') }} </label>
                                                <div class="col-md-8"> </div>
                                                <div class="col-md-12" style="position: relative; float: {!! (config('lang.direction')=='rtl') ? 'left' : 'right' !!}; padding-top: 10px; text-align: center;">
                                                    <div {!! (config('lang.direction')=='rtl') ? 'dir="rtl"' : '' !!} class="file-loading mb10">
                                                        <input id="pictureField" name="pictures[]" type="file" multiple class="file picimg">
                                                    </div>
                                                    <p class="help-block">
                                                        {{ t('Add up to :pictures_number photos. Use a real image of your product, not catalogs.', [
                                                            'pictures_number' => $picturesLimit
                                                        ]) }}
                                                    </p>
                                                </div>
                                            </div>
                                        @endif
                                        <div id="uploadError" style="margin-top:10px; display:none"></div>
                                        <div id="uploadSuccess" class="alert alert-success fade in" style="margin-top:10px;display:none"></div>


                                        <!-- Button -->
                                        <div class="form-group">
                                            <div class="col-md-12 mt20" style="text-align: center;">
                                                @if (getSegment(2) != 'create')
                                                    <a href="{{ lurl('posts/' . $post->id . '/edit') }}" class="btn btn-default btn-lg">{{ t('Previous') }}</a>
                                                @endif
                                                <a id="nextStepAction" href="{{ url($nextStepUrl) }}" class="btn btn-default btn-lg">{{ t('Skip') }}</a>
                                            </div>
                                        </div>

                                        <div style="margin-bottom: 30px;"></div
    
asked by anonymous 14.10.2018 / 09:27

1 answer

0

So I understand from your question you want to compress images that users "upload" so in that case the answer already exists right here on the stack and I recommend that you always be a researched before opening a new question

link: How to compress images in PHP?

    
15.10.2018 / 13:21