dbos1504's avatar

Image problem

Hello, I need some advice. I manage to make lets say a simple product (product has some text an images) and it is ok, it s working, i persist everything in database and img file in img folder in localhost, but problem was on live test server, i tried to upload 20 large images (try to test) and it blows up...memory problem. I found some vue component vue-image-uploader but now a have two routs for persisting my product. One route (route::post) is my route and the other is from vue image loader. Is there a way to combine these two routes in one...thanks

0 likes
12 replies
jlrdw's avatar

In the php ini increase the memory_limit. But bear in mind, have as small and optimized image as possible for the web.

And sorry it's been a while since I've done these settings, also look at upload_max_filesize

dbos1504's avatar

Hello, thanks for the reply, already try that (my ini is on 856m) and still everything is blowing up...this vue component is good but problem is that it requires to add another route for storing images

jlrdw's avatar

Try uploading only 4 or so at a time. Do you really need 20, many sites have 4, which is great plenty.

And I don't use Vue.

dbos1504's avatar

Well problem is that i do not control image upload - user is, i mean user will have option to upload images (max 20), i know i can restrict image size, but this vue component is doing exatly what i need, it can restrict user to upload max 20 images, it compress images, ads image preview, it can remove image before upload..etc, only problem is that i need one more route for uploading images, and i have a problem how to connect these routs.

Sinnbeck's avatar

Perhaps if you linked to the documentation of that vue plugin we could help you out? Or provide some code?

Sinnbeck's avatar
Sinnbeck
Best Answer
Level 102

Ok it seems you can add an url and in that you can add some unique identifier.

Let's say I try to create a new post. You then generate a key (kinda like crsf). You add this to each upload. When the user then saves the post itself you add the key to that as well, and will be able to link it all together.

You can also flip it around and save the post first and then upload images with the id if the new post

Sinnbeck's avatar

A third idea would be to just upload them and link them to the user id in the database, and then return the ids to the post. Then save the post with those ids

dbos1504's avatar

Hehehe i did the opposite, i save my blog and images later, because of that second route i could not link them

Sinnbeck's avatar

All three suggestions should make it easy. For 2 and 3,just make sure you return an id

Please or to participate in this conversation.