diff --git a/content/index.md b/content/index.md index 2b2a9ed..2decae3 100644 --- a/content/index.md +++ b/content/index.md @@ -2,3 +2,5 @@ The open-source flat-file cms for text-driven websites. Create handbooks, documentations, manuals, web-novels, traditional websites, and more. +![](media/live/youtube-6i2-uv88gke.jpeg){.center} + diff --git a/content/index.txt b/content/index.txt deleted file mode 100644 index 272072a..0000000 --- a/content/index.txt +++ /dev/null @@ -1 +0,0 @@ -["# Typemill","The open-source flat-file cms for text-driven websites. Create handbooks, documentations, manuals, web-novels, traditional websites, and more."] \ No newline at end of file diff --git a/system/Controllers/MediaApiController.php b/system/Controllers/MediaApiController.php index 7c3470d..093a425 100644 --- a/system/Controllers/MediaApiController.php +++ b/system/Controllers/MediaApiController.php @@ -161,7 +161,17 @@ class MediaApiController extends ContentController return $response->withJson(['errors' => 'Please check if your media-folder exists and all folders inside are writable.'], 500); } - if($imageProcessor->publishImage()) + # check the resize modifier in the image markdown, set it to true and delete it from markdown + $noresize = false; + $markdown = isset($params['markdown']) ? $params['markdown'] : false; + + if($markdown && (strlen($markdown) > 9) && (substr($markdown, -9) == '|noresize') ) + { + $noresize = true; + $params['markdown'] = substr($markdown,0,-9); + } + + if($imageProcessor->publishImage($noresize)) { $request = $request->withParsedBody($params); diff --git a/system/Models/ProcessAssets.php b/system/Models/ProcessAssets.php index b64c08d..466a13f 100644 --- a/system/Models/ProcessAssets.php +++ b/system/Models/ProcessAssets.php @@ -48,6 +48,8 @@ class ProcessAssets $this->fileFolder = $this->mediaFolder . 'files' . DIRECTORY_SEPARATOR; $this->desiredSizes = $desiredSizes; + + ini_set('memory_limit', '1024M'); } public function checkFolders($forassets = null) diff --git a/system/Models/ProcessImage.php b/system/Models/ProcessImage.php index 4bfceee..d0638ff 100644 --- a/system/Models/ProcessImage.php +++ b/system/Models/ProcessImage.php @@ -66,7 +66,7 @@ class ProcessImage extends ProcessAssets return false; } - public function publishImage() + public function publishImage($noresize = NULL) { # name is stored in temporary folder as name of the .txt-file foreach(glob($this->tmpFolder . '*.txt') as $imagename) @@ -97,11 +97,22 @@ class ProcessImage extends ProcessAssets if($tmpfilename[0] == 'original') { + if($noresize) + { + $success = copy($this->tmpFolder . $file, $this->liveFolder . $name . '.' . $tmpfilename[1]); + } $success = rename($this->tmpFolder . $file, $this->originalFolder . $name . '.' . $tmpfilename[1]); } if($tmpfilename[0] == 'live') { - $success = rename($this->tmpFolder . $file, $this->liveFolder . $name . '.' . $tmpfilename[1]); + if($noresize) + { + $success = unlink($this->tmpFolder . $file); + } + else + { + $success = rename($this->tmpFolder . $file, $this->liveFolder . $name . '.' . $tmpfilename[1]); + } } if($tmpfilename[0] == 'thumbs') { diff --git a/system/author/css/style.css b/system/author/css/style.css index e2cfee5..cc1b725 100644 --- a/system/author/css/style.css +++ b/system/author/css/style.css @@ -1589,6 +1589,22 @@ select{ background-color: #eee; } +/**** special alignment for image checkbox ****/ +.control-group.imgcheckmark{ + padding-left: 0; + font-size: .9em; +} +.control-group.imgcheckmark input{ + width: 0; + margin: 0; + left: 100%; + z-index: 9; +} +.imgcheckmark .checkmark{ + left: 100%; +} + + /******************** * TOOLTIP * ********************/ diff --git a/system/author/js/vue-blox.js b/system/author/js/vue-blox.js index 588820a..66729d4 100644 --- a/system/author/js/vue-blox.js +++ b/system/author/js/vue-blox.js @@ -94,6 +94,7 @@ const contentComponent = Vue.component('content-block', { this.edit = true; this.unsafed = true; this.compmarkdown = $event; + console.info(this.compmarkdown); this.setComponentSize(); }, setComponentSize: function() @@ -1462,6 +1463,7 @@ const imageComponent = Vue.component('image-component', { '' + '' + '' + + '' + '' + '', data: function(){ @@ -1479,6 +1481,8 @@ const imageComponent = Vue.component('image-component', { imgid: '', imgattr: '', imgfile: '', + showresize: true, + noresize: false, } }, mounted: function(){ @@ -1487,6 +1491,8 @@ const imageComponent = Vue.component('image-component', { if(this.compmarkdown) { + this.showresize = false; + this.imgmeta = true; var imgmarkdown = this.compmarkdown; @@ -1555,6 +1561,8 @@ const imageComponent = Vue.component('image-component', { methods: { openmedialib: function() { + this.showresize = false; + this.noresize = false; this.showmedialib = true; }, isChecked: function(classname) @@ -1653,6 +1661,11 @@ const imageComponent = Vue.component('image-component', { errors = 'Maximum size of image caption is 140 characters'; } } + + if(this.noresize === true) + { + imgmarkdown = imgmarkdown + '|noresize'; + } if(errors) { @@ -1686,8 +1699,10 @@ const imageComponent = Vue.component('image-component', { self = this; self.$parent.freezePage(); - self.$root.$data.file = true; - self.load = true; + self.$root.$data.file = true; + self.load = true; + self.showresize = true; + self.noresize = false; let reader = new FileReader(); reader.readAsDataURL(imageFile); @@ -1695,14 +1710,16 @@ const imageComponent = Vue.component('image-component', { self.imgpreview = e.target.result; - myaxios.post('/api/v1/image',{ + self.createmarkdown(); + + myaxios.post('/api/v1/image',{ 'url': document.getElementById("path").value, 'image': e.target.result, 'name': imageFile.name, 'csrf_name': document.getElementById("csrf_name").value, 'csrf_value': document.getElementById("csrf_value").value, }) - .then(function (response) { + .then(function (response) { self.load = false; self.$parent.activatePage(); @@ -1710,21 +1727,23 @@ const imageComponent = Vue.component('image-component', { self.imgmeta = true; self.imgfile = response.data.name; self.$emit('updatedMarkdown', '![]('+ response.data.name +')'); - }) - .catch(function (error) - { - /* + }) + .catch(function (error) + { + /* if(httpStatus == 400) { self.activatePage(); publishController.errors.message = "Looks like you are logged out. Please login and try again."; } */ - if(error.response) - { - publishController.errors.message = error.response.data.errors.message; - } - }); + + if(error.response) + { + publishController.errors.message = error.response.data.errors.message; + } + + }); } } }