question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Image Uploaded But not Inserting

See original GitHub issue

I am trying to upload image with php ( codeigniter ). Image upload works but after that model doesn’t close and images doesn’t get inserted in editor. I am getting success response

{"message":"uploadSuccess","file":"\/iwillgetit\/assets\/906873.jpg"}

Here is my code:

$('#text-editor').trumbowyg({
		btnsDef: {
			// Customizables dropdowns
			image: {
				dropdown: ['insertImage', 'upload'],
				ico: 'insertImage'
			}
		},
		btns: [
			['viewHTML'],
			['undo', 'redo'],
			['formatting'],
			['strong', 'em', 'del'],
			['superscript', 'subscript'],
			['link'],
			['image','noembed'],
			['justifyLeft', 'justifyCenter', 'justifyRight', 'justifyFull'],
			['unorderedList', 'orderedList'],
			['horizontalRule'],
			['removeformat'],
			//['emoji'],
			['fullscreen']
		],
		autogrow: true,
		//imageWidthModalEdit: true,
		plugins: {
			upload: {
				// Some upload plugin options, see details below
				serverPath: '<?php echo base_url(); ?>imageUpload.php',
				fileFieldName: 'storyimage',
				urlPropertyName: 'file',
				success: function (data, trumbowyg, $modal, values) {
					console.log(data);
					alert();
				}
			}
		}
	});

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:8 (2 by maintainers)

github_iconTop GitHub Comments

7reactions
melokkicommented, Jun 14, 2018

The image is not inserted because of this code

success: function (data, trumbowyg, $modal, values) {
					console.log(data);
					alert();
				}

remove this and the image should be inserted into the editor

2reactions
Alex-Dcommented, Jun 14, 2018

Read the docs: https://alex-d.github.io/Trumbowyg/documentation/plugins/#plugin-upload

You should also have a success property with a boolean for the sucess/error status. Not a message (which you can keep if you want, but add a sucess boolean property).

Read more comments on GitHub >

github_iconTop Results From Across the Web

PHP Uploading image but not inserting in DB - Stack Overflow
Current result: Able to upload multiple images to Upload folder but inserts only one image path / name period, even after attempting to...
Read more >
7 Reasons Why Images Are Not Loading on Your Website
Website images fail to load for one of these seven common reasons.
Read more >
How to Fix Image Upload Issue in WordPress (Step by Step)
Here is a simple tip that you can try if you haven't already tried it. Press the enter key twice after adding a...
Read more >
Insert image to a doc error message "unable ... - Google Support
I am editing a docs file, and on inserting an image, I navigate to gallery, choose an image and it then seems to...
Read more >
5 Ways to Fix Common WordPress Image Upload Issues
If you've tried all of the above fixes and are still encountering problems, you can use your browser's built-in file uploader. Unlike WordPress' ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found