GrapesJS / preset-newsletter

GrapesJS preset configuration for the newsletter editor.
https://grapesjs.com/demo-newsletter-editor.html
BSD 3-Clause "New" or "Revised" License
189 stars 143 forks source link

Image uploaded in remote server but not loading in asset manager #115

Closed udayanss closed 1 year ago

udayanss commented 2 years ago

Hello @artf , i am facing an issue for image not rendering inside the asset manager, can you please tell me if i am doing anything wrong

  1. Using the latest version grapesjs-preset-newsletter Here is the code of asset manager and storage manager storageManager: { id: "gjs-", // Prefix identifier that will be used on parameters type: "local", // Type of the storage autosave: true, // Store data automatically autoload: true, // Autoload stored data on init stepsBeforeSave: 1, // If autosave enabled, indicates how many changes are necessary before store method is triggered }, assetManager: { autoAdd: 1, assets: [], upload: 'https://staging.teks.co.in/udayan/newsletter-new/storage.php', uploadName: 'fileToUpload', }

    Inside script $turl = addslashes('https://staging.teks.co.in/udayan/newsletter-new/'.$target_file); $imageinsertArr = array( 'type'=> 'image', 'src'=> $turl, 'width'=> $width, 'height' => $height,

    ); array_push($resultArray,$imageinsertArr); $response = array( 'data' => $resultArray ); // echo json_encode( $response,JSON_UNESCAPED_SLASHES); echo json_encode( $response);

    Here is the response {"data":[{"type":"image","src":"https:\/\/staging.teks.co.in\/udayan\/newsletter-new\/images\/01-RDH_Human-brain_english- 750x900.png","width":750,"height":900}]}

artf commented 1 year ago

Here you can find the documentation on how to configure the Asset Manager for upload