Yii Framework Forum: [EXTENSION] Img - Yii Framework Forum

Jump to content

  • (3 Pages)
  • +
  • 1
  • 2
  • 3
  • You cannot start a new topic
  • You cannot reply to this topic

[EXTENSION] Img Image management made easy! Rate Topic: -----

#1 User is offline   Chris83 

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

Posted 01 April 2011 - 09:31 PM

Hello All,

It's been a while since I released my Rights module so I thought it was about time to give something new to the community. So, here it is, my newest module, Img.

Img is an image manager which allows for saving, loading, deleting and versioning of images in your Yii application. Images are stored both on the hard-drive and in the database. The module utilizes the PHPThumb library to provide a wide range of image transformation options.

Img comes with an installer so it's very easy to set up and you should have it up and running in no time. Here's a list of the features:

Features

  • Image management through one single application component.
  • Saving, loading and deleting of images easily
  • A wide variety of image transformation options
  • Active record for storing the image data
  • Installer for quick and easy set up
  • Extensive configuration options

The project can be found here:
http://www.yiiframew.../extension/img/ or

Fork Img on Bitbucket:
https://bitbucket.org/Crisu83/yii-img

Installation

Installation instructions can now be found here:
http://www.yiiframew...ension/img/#hh2

Thank you for reading

I hope you will find the module useful for your projects.
Please leave your comments and/or questions below.
Best regards,
Chris

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

Follow me:
Twitter | GitHub | Bitbucket
2

#2 User is offline   migueArgentina 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 133
  • Joined: 09-March 11

Posted 05 April 2011 - 01:43 PM

Hello Chris!

It seems like a HUGE job, Congratulations!

Can you post a demo please?
0

#3 User is offline   Chris83 

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

Posted 20 June 2011 - 08:24 AM

I've released Img version 1.0 and finally registered the extension on Yii:
http://www.yiiframew.../extension/img/

Enjoy!
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   Tuksi 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 1
  • Joined: 20-May 11

Posted 20 June 2011 - 08:26 AM

I'll have a dip in it today. Just quick q: does it do watermarking?
0

#5 User is offline   Chris83 

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

Posted 20 June 2011 - 08:43 AM

View PostTuksi, on 20 June 2011 - 08:26 AM, said:

I'll have a dip in it today. Just quick q: does it do watermarking?


Hey Tuksi,

I haven't done watermarking with it but it should support it, if Google can be trusted that is.

Here's a link you might find useful:
http://www.gen-x-des...mbnailer-class/

If you scroll down on the page you'll find some code for watermarking.
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   Chris83 

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

Posted 23 June 2011 - 05:49 AM

Version 1.0.1 is now available.

The newest version can be downloaded here:
http://www.yiiframew...-img-1.0.1.zip/

I changed the image extensions to be managed automatically.

Enjoy!
Best regards,
Chris

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

Follow me:
Twitter | GitHub | Bitbucket
0

#7 User is offline   josez 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 3
  • Joined: 27-June 11

Posted 27 June 2011 - 08:06 AM

Hello, i am new to yii and oo programming in php. i tried to use your module with code you provided in reply to "bonnie" in the module description.

i am getting error The table "{{Image}}" for active record class "Image" cannot be found in the database.
it is raised in saveImage() method.

the table in my database exists (i did run the install script of your module). i use mysql. can there be a problem with the capitalized first letter of table name? or any hints where is the problem?

can you please help me?
0

#8 User is offline   josez 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 3
  • Joined: 27-June 11

Posted 27 June 2011 - 09:22 AM

i changed the tableName() method in your class Image to return 'image' instead of '{{Image}}' and it works now. not sure if this is right i still do not understand the yii object concept entirely.
0

#9 User is offline   Chris83 

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

Posted 30 June 2011 - 04:08 AM

View Postjosez, on 27 June 2011 - 09:22 AM, said:

i changed the tableName() method in your class Image to return 'image' instead of '{{Image}}' and it works now. not sure if this is right i still do not understand the yii object concept entirely.


I'm not sure what the standard is but '{{Image}}' works if you set you 'db'-components 'tablePrefix' to "" (an empty string).

If there's a standard please let me know and I'll change it.
Best regards,
Chris

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

Follow me:
Twitter | GitHub | Bitbucket
0

#10 User is offline   bonnie 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 62
  • Joined: 08-February 11

Posted 16 July 2011 - 12:58 AM

Hi, Chris this is Bonnie again. I tried using the module to upload and display the images as you said but I don't see any file downloaded only my values for the auto listings. Also on the display the constant does not work. If you need I can post my code to see how am using it. I use CmultipleUpload widget for uploading. Thanks again. I really need help to get it working or if anybody has succeeded please help.
0

#11 User is offline   scribbly 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 30
  • Joined: 27-June 11
  • Location:Blue Mountains :: Australia

Posted 28 July 2011 - 06:49 PM

Hey Chris: I successfully installed and played with this last night -- thanks.

I'm still pretty new to Yii and PHP, but I think your extension is really only set up for a single model?

What I was hoping to do was to use it across my whole application, so that it would manage:
  • Product Images
  • Avatars
  • Product Category Images
  • etc


But to do that I'd think there would need to be a concept of the model in both the Db and file structure.

Is that something you're planning to do with this extension?
0

#12 User is offline   scribbly 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 30
  • Joined: 27-June 11
  • Location:Blue Mountains :: Australia

Posted 29 July 2011 - 09:54 AM

Forget that question... I should have played a little longer: it all works as expected.

I've just added an issue on your G.code page though: do you think that the versions should be deleted when you delete the Db record?

Would you do that by overriding the CActiveRecord delete method??

Actually just found the answer: beforeDelete() is the right way isn't it??

View Postscribbly, on 28 July 2011 - 06:49 PM, said:

Hey Chris: I successfully installed and played with this last night -- thanks.

I'm still pretty new to Yii and PHP, but I think your extension is really only set up for a single model?

What I was hoping to do was to use it across my whole application, so that it would manage:
  • Product Images
  • Avatars
  • Product Category Images
  • etc


But to do that I'd think there would need to be a concept of the model in both the Db and file structure.

Is that something you're planning to do with this extension?

This post has been edited by scribbly: 29 July 2011 - 09:58 AM

0

#13 User is offline   Chris83 

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

Posted 10 August 2011 - 04:32 AM

View Postscribbly, on 29 July 2011 - 09:54 AM, said:

Forget that question... I should have played a little longer: it all works as expected.

I've just added an issue on your G.code page though: do you think that the versions should be deleted when you delete the Db record?

Would you do that by overriding the CActiveRecord delete method??

Actually just found the answer: beforeDelete() is the right way isn't it??


Hey scribbly,

The problem is actually that the module doesn't implement support for deleting images at all. However, I recently added this functionality and it will be included in the next release.
Best regards,
Chris

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

Follow me:
Twitter | GitHub | Bitbucket
0

#14 User is offline   scribbly 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 30
  • Joined: 27-June 11
  • Location:Blue Mountains :: Australia

Posted 10 August 2011 - 05:09 AM

View PostChris83, on 10 August 2011 - 04:32 AM, said:

The problem is actually that the module doesn't implement support for deleting images at all. However, I recently added this functionality and it will be included in the next release.


:wub:
0

#15 User is offline   Chris83 

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

Posted 12 August 2011 - 02:01 AM

Version 1.0.2 is now available.

The newest version can be downloaded here:
http://www.yiiframew...-img-1.0.2.zip/

I added functionality for deleting images.

I'm also considering switching to the phpthumb() library as it provides a lot more functionality and it's being updated frequently.

Enjoy!
Best regards,
Chris

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

Follow me:
Twitter | GitHub | Bitbucket
0

#16 User is offline   rrbot 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 21
  • Joined: 23-August 10

Posted 24 August 2011 - 05:01 PM

I had the same problem as josez, same fix temporarily helped me out as well after trying image and tbl_image and tbl_Image as well.
(my prefix is tbl_) If I'm not mistaken, the convention for table names is lowercase.
0

#17 User is offline   rrbot 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 21
  • Joined: 23-August 10

Posted 24 August 2011 - 05:54 PM

What is the best way to render images in views?

I simply dropped this in my view, where $data->image is the Image id I placed in my model.

<img src="/files/images/versions/small/<?=$data->image_id?>.jpg" />

Thanks!
0

#18 User is offline   rrbot 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 21
  • Joined: 23-August 10

Posted 24 August 2011 - 06:25 PM

Chris,

Thanks for your module. I've just gotten it to work fully and have some suggestions:

1. saving a file name with just the id hurts the SEO value of the img file name
2. speaking of SEO, alt and title might be good additions (though maybe out of scope for your project?)
3. i'd love to see some type of easy rendering function that possibly worked with a lightbox type solution

Thanks again.
0

#19 User is offline   lehandr 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 10
  • Joined: 17-June 11
  • Location:Kharkov, Ukraine

Posted 28 September 2011 - 01:38 PM

Hello Chris!

First a big thanks for you great extensions!

Second — big sorry for my English.

About this one I want to ask you about the next items:
  • As I understand you position this module as common way to manage all application images. If this is right, I want to ask about your willing to create some storing mechanism to distribute images files by different directories to avoid server loading when count is over ~1000 or more files in one directory.
  • Maybe I did not figured how it works. What about caching created images? Will it always be recreated on each request?
  • Class ImgManager is declared as a child of CApplicationComponent, but in the ImgManager::init() method you don't call parent::init(). Is this the same as should be?

0

#20 User is offline   faz 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 1
  • Joined: 26-September 11

Posted 29 September 2011 - 07:49 AM

Firstly great work on this!!

I've started to use this and I noticed that some of the image conversions were a bit low quality - so I amended the phpThumb library to start using ImageMagick (instead of GD). Unfortunately this does not seem to work; i'm using auto-resizing of images (when called).

Any idea why this is not working?

Thanks
0

Share this topic:


  • (3 Pages)
  • +
  • 1
  • 2
  • 3
  • 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