Closed SandeepBanerjee closed 5 years ago
I had the same problem. but I changed the file path in the @include('mceImageUpload::upload_form')
view and it now works perfectly.
@the94air I am facing the same issue, I am unable to find any specified file path in upload_form
view.
Could you please let me know what exactly did you change??
Update: I fixed the issue doing the following:
Changed mce_back
function in the helper.php to:
function mce_back($filename)
{
return ("
<script>
top.$('.mce-btn.mce-open').parent().find('.mce-textbox').val('$filename').closest('.mce-window').find('.mce-primary').click();
</script>
");
}
And
Changed the uploadImage
method to this:
public function uploadImage(Request $request)
{
$image = $request->file('image');
$filename = 'image_'.time().'_'.$image->hashName();
$image = $image->move(public_path('img/uploads'), $filename);
$filepath = url('/img/uploads') .'/' .$filename;
return mce_back($filepath);
}
Screenshot:
@a-ssassi-n That is exactly what I did. It looks simple but completely powerful. It is so awesome.
@a-ssassi-n and everybody else, I would not recomend you to edit any files residing in vendor as it will get updated with every composer updates. Therefore, You must create a new helper function somewhere in app directory and register in the AppServiceProvider.php. This way you can use your own version of helper service and you do not have to keep changing the vendor files. The above solution by @a-ssassi-n is very effective but only for short period of time.
Thanks, @rambo666 I forgot to mention that in my comment. I have a helper file in my laravel app and I didn't edit the package helper file.
Hi i successfully add the images (Thank you very much for this), however i am unable to show the image it will look like this: