Comments (4)
The GalleryBehavior class has been refactorized and createFolders method has a bug. Due to the normalizePath method, the createDirectory method understands the file name as a folder and create the folders with the 'file/to/path/image.jpg' path instead of 'file/to/path'.
If you override createFolders method from GalleryBehavior class, it works fine. For example:
class GalleryBehavior extends \zxbodya\yii2\galleryManager\GalleryBehavior
{
private function createFolders($filePath)
{
return FileHelper::createDirectory(FileHelper::normalizePath(dirname($filePath)), 0777);
}
/**
* Replace existing image by specified file
*
* @param $imageId
* @param $path
*/
public function replaceImage($imageId, $path)
{
$this->createFolders($this->getFilePath($imageId, 'original'));
$originalImage = Image::getImagine()->open($path);
//save image in original size
//create image preview for gallery manager
foreach ($this->versions as $version => $fn) {
/** @var ImageInterface $image */
$image = call_user_func($fn, $originalImage);
if (is_array($image)) {
list($image, $options) = $image;
} else {
$options = [];
}
$image
->save($this->getFilePath($imageId, $version), $options);
}
}
}
from yii2-gallery-manager.
Hi,
@davarresc thanks for checking this - indeed there was PR merged recently, changing this method #62
can you create pr with your fix?
from yii2-gallery-manager.
Hi,
Yes of course, I just did the PR.
Regards.
from yii2-gallery-manager.
thanks, merged it 👍
@amismailz can you check is it fixed you issue?
from yii2-gallery-manager.
Related Issues (20)
- How to create squared version of image? HOT 1
- Use gallery-manager widget in bootstrap modal window HOT 1
- Unexpected rights with createFolder HOT 1
- How about add index to type column
- Delete all nested folders
- GalleryImage extends \yii\db\ActiveRecord
- Avoid upperCase in url
- How about fit preview image into preview image area? HOT 1
- Arrange not working on fresh-uploading images
- Is it possible to use non web-accessable directory to store images?
- Не полупрозрачные тени при создании миниатюр HOT 4
- $path is empty HOT 1
- Call to a member function getBehavior() on null HOT 6
- svg upload HOT 2
- Прозрачность при загрузке PNG
- Главное изображение HOT 2
- Alt attribute
- SVG FILES
- Is it possible to have dynamic extensions? HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from yii2-gallery-manager.