Upload Photos in Medium Editor

I’ve looked around at the video tutorials, docs and forum but I see no mention of how to upload photos with the medium editor. I’m assuming this is out there somewhere but this might be a nice addition to the forum!

I’ve tried figuring it out myself. I have a database table with the text from the medium editor and the blob. In Wappler I have the database insert working for the text, and I made a separate server action for the image. This didn’t work so I tried adding a step to the existing insert server action for uploading the image which also didn’t work.

I think the problem is in the element name for the medium editor. Because I am using that post variable for the text how do I use it for the image?

Thanks!

The name of the upload in medium editor is predefined as 'image" to define a POST variable

So create your sever action for image upload

image

perform an image upload (change path to suit)

image

Resize as necessary

image

Then save

1 Like

Great thank you!

In the load image step did you select the dynamic attribute for image path {{upload1}} ?

You can set a dynamic path or mix of dynamic and static using the using bracketed notation, for example if you wanted each user to have their own sub under /images based in their id you could use something like

/images/{{security1.identity}} or /images/{{$_POST.userid}}

(dont forget to check create path in such as case)

Also, in case you haven’t done so.

  • Select your medium field
  • Add Medium Addon

16%20AM

Alright so I’ve almost got it working. Now I can successfully upload photos, however they will not display. I just see the broken image icon. So I’m guessing my problem is the Load Image step. My path is set to {{upload1.path}}. File upload’s name is set to upload1. Is this correct?

I also tried manually entering the path like this: /assets/Mediumeditorimages/{{upload1.name}}

This didn’t work.

Will the medium editor automatically display images if you have a query set up for it? I am expecting the images to show up along with the text in the query I have set up already. Is that an incorrect assumption and I need a new query for images?

Hey, i would recommend to avoid using the medium editor as the library has been deprecated since 2017

Hi Logan

Your images are uploaded correctly, all loading into the \assets\MediumEditorimages folder
I suggest you remove spaces from the file names (checkbox option) as spaces sometimes cause issues

HOWEVER, big apologies, i failed to explain the last step needed (you may have noticed it in the screen grabs but i forgot to explain it (i was in a rush to go out)

You need to return the URL of the image to medium editor after processing at the end of the server action

So add this to the end of the upload action and all should be working

The value returned MUST be called “url”

3 Likes

@Hyperbytes, I am hopping you can help me with this as I am having the same issue. I spent so many hours trying to fix it but nothing is working.

I have the following:
Step 1: File upload
image

Step 2: Load image

Step 3: Resize image
image

Step 4: Save image
image

Step 5: Set value

Outcome
image

I am not getting any errors and the image is uploading to the server.

Any help will be much appreciated.
Thanks
Juan

Hello,
Please provide a link to your page, where i can check this.

@Teodor this is the url to the page http://mymdsdigital.com/Synergy/Admin-Projects-Details-ReportTypezIssueAdd2.php?cp_id=7&aai_id=8&pi_id=7&org_id=14&page=current&aai_type=Common%20Component,
Please let me know if you need anything else.
Thanks
Juan

The image ulpload addon is not enabled in your first editor options, where the issue happens.
Works fine in the other two.

@Teodor, thanks for getting back to me so quickly. Actually the image upload addon is enabled. see image below:
image

Note the issue takes place only after I add the sever action to the image upload addon.

The other 2 do not have the image upload addon is enabled. (see image below)
image

However, you are right that Medium Editor for the other 2 have the add image enable, I am trying to remove it from the interface as I don’t want users to upload to those editors.

Please let me know if you need anything else.

Thanks

Juan

Sorry i don’t understand you.

On the link you sent me - the bottom two editors had the image addon added to them. There was no issue uploading the image there.

The first editor didn’t have the image addon added, and that’s where the issue happens.

@Teodor, please do not be sorry, it may be me not being able to properly explain.

The first Medium Editor is the one that should upload the images. that one has the image upload addon enabled.

The last 2 Medium Editor do not have the the image upload addon.

Please note: that for the first Medium Editor (the one with the error) if I were to remove the server action, then when I add an image it shows in the Medium Editor, but as soon as the server action is added, the image no longer shows. That is why I have added the steps I used, as I think the I am doing something wrong in there.

Please let me know if you need anything else.

Thanks

Juan

I created a small update for the editor for the image upload extension, please check if the update solves your problem.

dmxMediumEditor.zip (6.1 KB)

Hi @patrick thanks a lot for helping me on this. I had replaced the file, however I am still getting the same issue. However, I wan to make sure it is not me adding the file to the wrong place. I replaced the file under this folder path (dmxAppConnect\dmxMediumEditor). could you please confirm if I did it correctly.
Thanks again for all your help.
Best regards
Juan

Yes, and please make sure to upload it to your server as well and do a hard refresh (Ctrl+f5) to clear the browser cache.

To make sure that image upload extension is not used, you must make sure that the medium:image-upload attribute is not on the editor element.

Hi @Teodor/@patrick, thanks again for your help!
Ok, so have made sure that the file was on the server. I did the hard refresh. Good new is that the upload extension icon is no longer a problem with the new js file. However right now the image preview is not added text editor area. (note the image uploads to the server without any issues)
The page is:
http://mymdsdigital.com/Synergy/Admin-Projects-Details-ReportTypezIssueAdd2.php?cp_id=7&aai_id=8&pi_id=7&org_id=14&page=current&aai_type=Common%20Component

Thanks for your help
Best regards
Juan