compress/ compress image after upload on my website

Asked

Viewed 254 times

-1

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

<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

1 answer

0

From what I understand of your question you want to compress images that users "go up" so in this case the answer already exists right here in the stack and I recommend that you always a searched before opening a new question

link: How to compress images in PHP?

Browser other questions tagged

You are not signed in. Login or sign up in order to post.