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

Jump to content

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

[EXTENSION] EPhpThumb A lightweight wrapper for phpThumb Rate Topic: -----

#1 User is offline   Haensel 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 444
  • Joined: 14-January 11
  • Location:Vienna (Austria)

Posted 25 January 2012 - 10:51 AM

Hi,

EPhpThumb is a lightweight extension for the well known phpThumb library (PhpThumb). There are a lot of extensions out there providing more functionality but they can be total overkill for just creating some thumbnails and saving them to disk. I had this problem so I simply created this extension and want to share it with the Yii community.

If you experience any difficulties, bugs or have some questions post them in here.
0

#2 User is offline   Olim Saidov 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 2
  • Joined: 23-March 10

Posted 26 January 2012 - 09:44 AM

Is there any caching functionality in this library and how can I turn it on?
0

#3 User is offline   Haensel 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 444
  • Joined: 14-January 11
  • Location:Vienna (Austria)

Posted 26 January 2012 - 10:11 AM

PhpThumb doesn't provide caching out of the box. You'll have to implement your own mechanisms. Take a look at this issue on Github
0

#4 User is offline   rodrigoslompo 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 4
  • Joined: 28-March 12
  • Location:Brazil/PR

Posted 30 March 2012 - 11:03 AM

do not understand where should I put this setting in the main.

right into the main array configuration or some sub array as import, modules or components?

when using the configuration in the main, when trying to use the controller

$ thumb = Yii :: app () -> phpThumb-> create (.. / images / site / news / sample.jpg ');

I get the message:
The property "CWebApplication.phpThumb" is not defined.


and if I use the import

Yii :: import ("ext.EPhpThumb.EPhpThumb");

$ thumb = new EPhpThumb ();
$ thumb-> init () / / this is needed

/ / chain functions
$ thumb-> create ('.. / images / big.jpg');
$ thumb-> resize (200,200);
$ thumb-> save ('.. / images / small.jpg');

the message is
EPhpThumb and Its behaviors of the method or not have a closure named "resize".
0

#5 User is offline   Haensel 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 444
  • Joined: 14-January 11
  • Location:Vienna (Austria)

Posted 04 April 2012 - 04:00 AM

Hi and sorry for the late reply,

Did you put the phpThumb config within the "components" config part in your main?

"components"=>array(
    ...components like user, logRoutes etc.....
    'phpThumb'=>array(
        'class'=>'ext.EPhpThumb.EPhpThumb',
    ),
)

0

#6 User is offline   viil 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 6
  • Joined: 04-September 12

Posted 04 September 2012 - 06:53 PM

Hi,
I am using the EPhpThumb extension, and it was working well on both localhost and my test server, but literally over night it stopped working on localhost (WAMP set up) and I got the following error message:

include_once([my yii app path]\protected\extensions\EPhpThumb\lib\phpThumb\src\thumb_plugins\_notes) [<a href='function.include-once'>function.include-once</a>]: failed to open stream: Permission denied


On my dev server (identical LAMP set up as the test server where it works) I get the following error:

include_once([my yii app path]/protected/extensions/EPhpThumb/lib/phpThumb/src/thumb_plugins/_notes) [<a href='function.include-once'>function.include-once</a>]: failed to open stream: Invalid cross-device link


Any suggestions?

Thanks :)
0

#7 User is offline   Haensel 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 444
  • Joined: 14-January 11
  • Location:Vienna (Austria)

Posted 05 September 2012 - 09:39 AM

I guess the problem is a link between two different partitions which isn't possible. Do you use any symbolic links like that?
0

#8 User is offline   viil 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 6
  • Joined: 04-September 12

Posted 05 September 2012 - 04:10 PM

Thanks for replying Haensel.
My localhost has no partitions, and both the dev and test servers are shared linux hosted servers. I just find it strange that the code works on test, not on dev, and did work for a while on localhost. The code is of course identical. I am including EPhpThumb in the controller, not in the config file.

Viil

View PostHaensel, on 05 September 2012 - 09:39 AM, said:

I guess the problem is a link between two different partitions which isn't possible. Do you use any symbolic links like that?

0

#9 User is offline   Haensel 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 444
  • Joined: 14-January 11
  • Location:Vienna (Austria)

Posted 06 September 2012 - 11:34 AM

Do you see a dwsync.xml in the "_notes" directory mentioned in the error message? I am not sure what it is, it is not distributed with my extension so I guess it is either created by phpThumb or something else (it seems like Dreamweaver is creating it too): https://www.google.a...chrome&ie=UTF-8
0

#10 User is offline   viil 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 6
  • Joined: 04-September 12

Posted 06 September 2012 - 04:06 PM

That was it! I removed the "_notes" directories which as you said probably were put in by dreamweaver and were hidden by several of the tools I used for viewing the file hierarchy. EPhpThumb is now working perfectly again on all three servers.

Thank you Haensel :)


View PostHaensel, on 06 September 2012 - 11:34 AM, said:

Do you see a dwsync.xml in the "_notes" directory mentioned in the error message? I am not sure what it is, it is not distributed with my extension so I guess it is either created by phpThumb or something else (it seems like Dreamweaver is creating it too)

0

#11 User is offline   Laret 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 15
  • Joined: 21-August 12
  • Location:Poland

Posted 07 September 2012 - 05:44 AM

Hi I have question.

I need resize big image like this:

$thumb->resize(610,246);


My image change width to 610px and height to 610px

This extension resize only quadrat images?
That would be able to change the rectangle?
0

#12 User is offline   Haensel 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 444
  • Joined: 14-January 11
  • Location:Vienna (Austria)

Posted 07 September 2012 - 07:12 AM

That's usually only the case when using $thumb->adaptiveResize(x,y) so I don't understand why the above example isn't working. Maybe you could post all your code you are using in here?
0

#13 User is offline   Laret 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 15
  • Joined: 21-August 12
  • Location:Poland

Posted 07 September 2012 - 08:15 AM

My code:
$thumb=Yii::app()->phpThumb->create($images_path . '/'. $model->name);
$thumb->resize(610,246);
$thumb->save($images_path . '/'. $model->name);


If use
$thumb->adaptiveResize(610,246)
it's good size but image it's cropped :(
0

#14 User is offline   Haensel 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 444
  • Joined: 14-January 11
  • Location:Vienna (Austria)

Posted 07 September 2012 - 10:30 AM

The cropping is intended if you're using adaptiveResize() but if you are only using resize() this should not happen. The only thing I can imagine now is that this has to do with the size of the image itself so what's the size of your original image in terms of width and height?
0

#15 User is offline   Laret 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 15
  • Joined: 21-August 12
  • Location:Poland

Posted 10 September 2012 - 02:26 AM

I tested on to many sizes images, and effect is the same(Sample sizes: 3264x2448, 1746x1181).
0

#16 User is offline   Haensel 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 444
  • Joined: 14-January 11
  • Location:Vienna (Austria)

Posted 10 September 2012 - 08:38 AM

Strange, I guess it has to do with the way phpThumb auto-calculates the ratio of an image when using resize(). The original docs may be helpful: https://github.com/m...iki/Basic-Usage
0

#17 User is offline   donrra 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 2
  • Joined: 03-August 11

Posted 13 October 2012 - 06:42 AM

View PostHaensel, on 04 April 2012 - 04:00 AM, said:

Hi and sorry for the late reply,

Did you put the phpThumb config within the "components" config part in your main?

"components"=>array(
    ...components like user, logRoutes etc.....
    'phpThumb'=>array(
        'class'=>'ext.EPhpThumb.EPhpThumb',
    ),
)



Hi Haensel

I am not sure what I am doing wrong; I have placed the phpThumb within components in main.php; I can now choose the ePHPThumb widget and specify the folder where images should be stored (tried the default location and other folders with permission 755).Users can choose and upload images to their profile (images ARE stored on server), but no one can actually see the images. I am not even getting any error even when uploading images.

What could have missed, since images are not visible? Thanks!
0

#18 User is offline   Haensel 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 444
  • Joined: 14-January 11
  • Location:Vienna (Austria)

Posted 13 October 2012 - 11:57 AM

Could you please post your code (the part where you are using phpThumb to save the images) because I am not sure what you mean. You don't see the image files or the image files don't render in browsers?

Btw.: 755 will only make sense if the owner of the folder is the webserver process (e.g.: www-data)
0

#19 User is offline   lup0z 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 60
  • Joined: 02-May 11

Posted 05 November 2012 - 04:01 AM

Hi,
I'm trying to use ephpthumb extension.
After editing the config/main.php file and put the code below in my controller - create action like this:

$thumb = Yii::app()->phpThumb->create(Yii::app()->baseUrl.'/images/articoli/'.$model->image);
				$thumb->resize(128,128);
				$thumb->save(Yii::app()->baseUrl.'/images/articoli/thumbnails/thumb_'.$model->image);


I get this CException:

Quote

Alias "ext.EPhpThumb.EPhpThumb" is invalid. Make sure it points to an existing PHP file.


I think (of course) I have to put EPhpThumb in /extension but which files?
Thaank you

EDIT: resolved just copying the EPhpThumb folder in /extension :) Oh holy ignorance!
0

#20 User is offline   SilvQ 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 13
  • Joined: 08-October 10

Posted 05 December 2012 - 09:39 AM

How can i make resize imahe thumb without saving, from remote url like: http:// example.com/avatar.png
0

Share this topic:


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