diff --git a/src/Controller/CKEditorUploadImageController.php b/src/Controller/CKEditorUploadImageController.php
index fb8a61a..ab9e35a 100644
--- a/src/Controller/CKEditorUploadImageController.php
+++ b/src/Controller/CKEditorUploadImageController.php
@@ -6,6 +6,8 @@
 
 namespace Drupal\ckeditor_uploadimage\Controller;
 
+use Drupal\media\Entity\Media;
+use Drupal\node\NodeInterface;
 use Drupal\Core\Controller\ControllerBase;
 use Drupal\Component\Utility\Bytes;
 use Symfony\Component\HttpFoundation\Request;
@@ -87,7 +89,7 @@ class CKEditorUploadImageController extends ControllerBase {
         $uri  = $file[0]->getFileUri();
         $uuid = $file[0]->uuid();
         $fileName = $fileSystem->basename($uri);
-        $url = file_url_transform_relative(file_create_url($uri));
+        $url = \Drupal::service('file_url_generator')->generateString($uri);
         $entityType = $file[0]->getEntityTypeId();
         $moduleHandler = \Drupal::service('module_handler');
         if ($moduleHandler->moduleExists('inline_responsive_images')){
@@ -106,12 +108,12 @@ class CKEditorUploadImageController extends ControllerBase {
           $mediaImageFields = \Drupal::service('entity_field.manager')->getFieldDefinitions('media', 'image');
           if (isset($mediaImageFields['field_media_image']) && $imageUpload['media_entity_image']) {
             // Create media entity with saved file.
-            $imageMedia = \Drupal\media\Entity\Media::create([
+            $imageMedia = Media::create([
               'bundle' => 'image',
               'name' => $alt,
               'uid' => \Drupal::currentUser()->id(),
               'langcode' => \Drupal::languageManager()->getDefaultLanguage()->getId(),
-              'status' => \Drupal\node\NodeInterface::PUBLISHED,
+              'status' => NodeInterface::PUBLISHED,
               'thumbnail' => [
                 'target_id' => $file[0]->id(),
               ],
diff --git a/src/Plugin/CKEditorPlugin/DrupalUploadImage.php b/src/Plugin/CKEditorPlugin/DrupalUploadImage.php
index 77cd72f..05de855 100644
--- a/src/Plugin/CKEditorPlugin/DrupalUploadImage.php
+++ b/src/Plugin/CKEditorPlugin/DrupalUploadImage.php
@@ -41,7 +41,7 @@ class DrupalUploadImage extends PluginBase implements CKEditorPluginInterface, C
    * {@inheritdoc}
    */
   function getFile() {
-    return drupal_get_path('module', 'ckeditor_uploadimage') . '/js/plugins/' . $this->getPluginId() . '/plugin.js';
+    return \Drupal::service('extension.list.module')->getPath('ckeditor_uploadimage') . '/js/plugins/' . $this->getPluginId() . '/plugin.js';
   }
 
   /**
diff --git a/src/Plugin/CKEditorPlugin/DrupalUploadImageImce.php b/src/Plugin/CKEditorPlugin/DrupalUploadImageImce.php
index fe2cccd..8c29810 100644
--- a/src/Plugin/CKEditorPlugin/DrupalUploadImageImce.php
+++ b/src/Plugin/CKEditorPlugin/DrupalUploadImageImce.php
@@ -41,7 +41,7 @@ class DrupalUploadImageImce extends PluginBase implements CKEditorPluginInterfac
    * {@inheritdoc}
    */
   function getFile() {
-    return drupal_get_path('module', 'ckeditor_uploadimage') . '/js/plugins/drupaluploadimage/plugin.js';
+    return \Drupal::service('extension.list.module')->getPath('ckeditor_uploadimage') . '/js/plugins/drupaluploadimage/plugin.js';
   }
 
   /**
