diff --git a/behaviors/ImageBehave.php b/behaviors/ImageBehave.php index 12acb29..1936f2f 100755 --- a/behaviors/ImageBehave.php +++ b/behaviors/ImageBehave.php @@ -51,7 +51,7 @@ public function attachImage($absolutePath, $isMain = false, $name = '') $pictureFileName = substr(md5(microtime(true) . $absolutePath), 4, 6) - . '.' . + . '.jpg' . pathinfo($absolutePath, PATHINFO_EXTENSION); $pictureSubDir = $this->getModule()->getModelSubDir($this->owner); $storePath = $this->getModule()->getStorePath($this->owner); diff --git a/models/Image.php b/models/Image.php index 2948333..ab41db6 100755 --- a/models/Image.php +++ b/models/Image.php @@ -52,7 +52,7 @@ public function getExtension(){ public function getUrl($size = false){ $urlSize = ($size) ? '_'.$size : ''; $url = Url::toRoute([ - '/'.$this->getPrimaryKey().'/images/image-by-item-and-alias', + '/'.$this->getModule()->id.'/images/image-by-item-and-alias', 'item' => $this->modelName.$this->itemId, 'dirtyAlias' => $this->urlAlias.$urlSize.'.'.$this->getExtension() ]);