Yii Framework Forum: [Extension] Yii-Imagemanager - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

[Extension] Yii-Imagemanager A toolkit for managing image in your application. Rate Topic: -----

#1 User is offline   Chris83 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 434
  • Joined: 27-February 10
  • Location:Helsinki, Finland

Posted 01 September 2013 - 04:52 PM

Hey All,

This is the thread for discussing my latest extension, Yii-ImageManager:
http://www.yiiframew...i-imagemanager/

Feel free to post any questions you have regarding extension below.
Best regards,
Chris

My contribution to the Yii community:
Yiistrap | Auth | Bootstrap | NordCms | Rights | LESS | SEO | Img

Follow me:
Twitter | GitHub | Bitbucket
0

#2 User is offline   casinho 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 7
  • Joined: 21-October 12

Posted 04 September 2013 - 05:56 AM

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?
0

#3 User is offline   Chris83 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 434
  • Joined: 27-February 10
  • Location:Helsinki, Finland

Posted 05 September 2013 - 03:58 PM

View Postcasinho, on 04 September 2013 - 05:56 AM, said:

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/C...getting-started

I hope this helps.
Best regards,
Chris

My contribution to the Yii community:
Yiistrap | Auth | Bootstrap | NordCms | Rights | LESS | SEO | Img

Follow me:
Twitter | GitHub | Bitbucket
0

#4 User is offline   casinho 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 7
  • Joined: 21-October 12

Posted 06 September 2013 - 02:48 PM

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.
0

#5 User is offline   Chris83 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 434
  • Joined: 27-February 10
  • Location:Helsinki, Finland

Posted 08 September 2013 - 02:34 PM

View Postcasinho, on 06 September 2013 - 02:48 PM, said:

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.
Best regards,
Chris

My contribution to the Yii community:
Yiistrap | Auth | Bootstrap | NordCms | Rights | LESS | SEO | Img

Follow me:
Twitter | GitHub | Bitbucket
0

#6 User is offline   casinho 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 7
  • Joined: 21-October 12

Posted 10 September 2013 - 06:44 AM

View PostChris83, on 08 September 2013 - 02:34 PM, said:

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.
0

#7 User is offline   Chris83 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 434
  • Joined: 27-February 10
  • Location:Helsinki, Finland

Posted 14 September 2013 - 02:39 PM

View Postcasinho, on 10 September 2013 - 06:44 AM, said:

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/C...gemanager#setup
Best regards,
Chris

My contribution to the Yii community:
Yiistrap | Auth | Bootstrap | NordCms | Rights | LESS | SEO | Img

Follow me:
Twitter | GitHub | Bitbucket
0

#8 User is offline   esp 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 7
  • Joined: 02-April 12

Posted 08 October 2013 - 09:29 AM

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
0

#9 User is offline   dan_ 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 25
  • Joined: 04-November 13

Posted 27 November 2013 - 09:45 AM

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

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

Thanks
0

#10 User is offline   gb5256 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 40
  • Joined: 22-April 11

Posted 02 March 2014 - 04:31 PM

View Postcasinho, on 10 September 2013 - 06:44 AM, said:

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.

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
0

#11 User is offline   Shakil Hussain 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 27
  • Joined: 12-February 14
  • Location:Dhaka, Bangladesh

Posted 09 March 2014 - 08:01 AM

View PostChris83, on 01 September 2013 - 04:52 PM, said:

Hey All,

This is the thread for discussing my latest extension, Yii-ImageManager:
http://www.yiiframew...i-imagemanager/

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


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:::::

Quote

array('image','file','types'=>"jpg,gif,png",'message'=>'Invalid'),


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

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users