[Extension] Yii-Imagemanager

Hey All,

This is the thread for discussing my latest extension, Yii-ImageManager:

http://www.yiiframework.com/extension/yii-imagemanager/

Feel free to post any questions you have regarding extension below.

Hi Chris,

installation with composer of all required extension was successfull… but [maybe a dumb question], how to use it? How can work with the imageManager?

Can I have a simple example?

Hello casinho,

There are no dumb questions, besides you have a good point. I didn’t have time to write the instructions a few days ago and I apologize for that.

I have added a simple example on how to use the extension for saving product images here:

https://github.com/Crisu83/yii-imagemanager/blob/master/README.md#getting-started

I hope this helps.

Yes, it helps! But I have a problem with the fileManager now.

When Im calling saveImage in my model I got the following error-message


ImageManager.fileManagerID "fileManager" is invalid, please make sure that exists. 

I have really no idea how to fix this.

That would mean that you haven’t configured the file manager for your application.

Ok, I fixed that.

Image-Upload and relations between the models are working.

But I have still some questions.

In your example the image-upload saves just the raw image-file, right? So the following part in your view ist not working:




<div class="product-image">

      <?php echo $model->renderImagePreset('product', $model->name, array(), 'default'); ?>

    </div>



In my case it is:




<div class="product-image">

      <?php echo $model->renderImagePreset('myPreset', $data->name, array(), 'default'); ?>

    </div>



Which results in


<div class="product-image">

IMAGE: /images/post/testing.jpg

<img alt="Testing" src="/files/images/cache/myPreset/af2b5c93/images/post/testing.jpg">

</div>

Do I have to create every preset-process manually after saving the image in my model?

I tried it with calling the ImageController from my PostController:




..

			if($model->validate()) {

				$model->save(false); 

			  	if ($model->uploadedFile !== null) {

         			$image = $model->saveImage($model->uploadedFile, $model->title, 'images/post/');

         			

					Yii::import('application.vendor.crisu83.yii-imagemanager.controllers.ImageController');

					$controller_instance = new ImageController('Image');

					$controller_instance->actionPreset('myPreset',$image->id,$image->file->extension);              			

        		}

				

				$this->redirect(array('view','id'=>$model->id));

			}

...



This one worked more or less - image saved. But I think I didn`t use it the right way.

No, you don’t have to create the preset manually. Instead you can set up the automatic generation of missing images using an .htaccess file.

See the following part of the README.md for more info: https://github.com/Crisu83/yii-imagemanager#setup

Hi Chris83

Thanks for the help and exciting extension, but I’m having problem displaying the image.

It’s correctly added to DB but when I write:


$model->renderImagePreset('product', $model->name, array(), 'default')

this is generated


<img src="files/images/cache/product/cd61fe91/products/Biurko1-2.jpg" alt="Biurko1" />

but except image the alt value is shown.

the file is located /file/images/raw/ no cache is configured but I don’t know how.

Maybe you can help.

Thanks in advance

Hi Chris, can you explain how to install without composer?

My app was developed without composer and i’m a newbie.

Thanks

Hello Casinho,

can you share how you have configured the file-manager?

there are now docs about that on github, so perhaps you can post it here?

Thanks,

gb5256

How can i validate only image extension without page load. when a image upload it will check immediate whether it is match with extension or not. user will get a message instantly. i do it by that way:::::

but it work only after page load…i want it will check instantly when upload…plz explain with example…

I need help

I can’t execute the instrucction:

yiic image createAccessFile --baseUrl="<base/url>" --path="<path/to/images>"

for my project.

skeleton (/var/www/yii_composer)

yiic image createAccessFile --baseUrl=/yii_composer --path=/images/banner

Regards