[EXTENSION] EPhpThumb

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

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.at/search?q=dwsync.xml&aq=f&sugexp=chrome,mod=9&sourceid=chrome&ie=UTF-8

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

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?

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?

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

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?

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

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/masterexploder/PHPThumb/wiki/Basic-Usage

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!

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)

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:

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!

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

Hi all.

I am getting this


CException


EThumbnail and its behaviors do not have a method or closure named "create". (C:\wamp\www\yii\framework\base\CComponent.php:265)


#0 C:\wamp\www\vivienda\protected\controllers\OpViviendasController.php(303): CComponent->__call('create', Array)

#1 C:\wamp\www\vivienda\protected\controllers\OpViviendasController.php(303): EThumbnail->create('C:\wamp\www\viv...')

#2 C:\wamp\www\yii\framework\web\actions\CInlineAction.php(49): OpViviendasController->actionUploadfoto()

#3 C:\wamp\www\yii\framework\web\CController.php(308): CInlineAction->runWithParams(Array)

#4 C:\wamp\www\yii\framework\web\filters\CFilterChain.php(133): CController->runAction(Object(CInlineAction))

#5 C:\wamp\www\yii\framework\web\filters\CFilter.php(40): CFilterChain->run()

#6 C:\wamp\www\yii\framework\web\CController.php(1145): CFilter->filter(Object(CFilterChain))

#7 C:\wamp\www\yii\framework\web\filters\CInlineFilter.php(58): CController->filterAccessControl(Object(CFilterChain))

#8 C:\wamp\www\yii\framework\web\filters\CFilterChain.php(130): CInlineFilter->filter(Object(CFilterChain))

#9 C:\wamp\www\yii\framework\web\CController.php(291): CFilterChain->run()

#10 C:\wamp\www\yii\framework\web\CController.php(265): CController->runActionWithFilters(Object(CInlineAction), Array)

#11 C:\wamp\www\yii\framework\web\CWebApplication.php(282): CController->run('uploadfoto')

#12 C:\wamp\www\yii\framework\web\CWebApplication.php(141): CWebApplication->runController('opViviendas/upl...')

#13 C:\wamp\www\yii\framework\base\CApplication.php(169): CWebApplication->processRequest()

#14 C:\wamp\www\vivienda\index.php(13): CApplication->run()

#15 {main}

the main…


'components' => array(

        'phpThumb' => array(

            'class' => 'ext.EPhpThumb.EPhpThumb',

//    'options'=>array(optional phpThumb specific options are added here)

        ),

the controller…


          $thumb = Yii::app()->phpThumb->create($folder . $result['filename']);

                $thumb->create($folder . $result['filename']);

                $thumb->resize(100, 100);

                $thumb->save($folder . "thumb\\" . $result['filename']);



Ive tried everything, I am pretty sure is something easy to solve but I cant just figure it out yet.

Thanks.

pd.

I am using WAMP 2.2 PHP 5.4.3 Apache 2.4.2


gd

GD Support 	enabled

GD Version 	bundled (2.0.34 compatible)

FreeType Support 	enabled

FreeType Linkage 	with freetype

FreeType Version 	2.4.6

T1Lib Support 	enabled

GIF Read Support 	enabled

GIF Create Support 	enabled

JPEG Support 	enabled

libJPEG Version 	6b

PNG Support 	enabled

libPNG Version 	1.2.46

WBMP Support 	enabled

XBM Support 	enabled 

You are trying to create a thumb from a thumb which is not possible. Try this




$thumb = Yii::app()->phpThumb->create($folder . $result['filename']);

//$thumb->create($folder . $result['filename']); this line is wrong, so delete it

$thumb->resize(100, 100);

$thumb->save($folder . "thumb\\" . $result['filename']);



working!

I had some error, tried the without main.php configuration (thats when I put that line) now I got back removing that line and everything works fine.

At least is working. Thank you very much!

public function actionCreate()

{ 


       


	$model=new CategoryPlaces;








	// Uncomment the following line if AJAX validation is needed


	// $this->performAjaxValidation($model);





	 


	


	


	if(isset($_POST['CategoryPlaces']))


	{


		$model->attributes=$_POST['CategoryPlaces'];


		 $rnd = rand(0,9999);


		 $uploadedFile=CUploadedFile::getInstance($model,'image'); 


            // random number + file name


            $fileName = "{$rnd}-{$uploadedFile}"; 


            // get image with Number


            $model->image = $fileName;


  //$thumb=Yii::app()->phpThumb->create($uploadedFile);


     // $thumb->resize(100,100);


     








      $thumb = Yii::app()->phpThumb->create(Yii::app()->baseUrl.'/images/'.$model->image);


                            $thumb->resize(128,128);


                           // $thumb->save(Yii::app()->baseUrl.'/images/articoli/thumbnails/thumb_'.$model->image);

i have erorr like this

[color="#FF0000"]Alias "ext.EPhpThumb.EPhpThumb" is invalid. Make sure it points to an existing PHP file and the file is readable. [/color]

please help…?

excuse me, i want to know where will i place my ephpthumb in my app. thanks… please feedback.

Hi, guys.

Can you please help me?! Where should I paste this lines to?


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

$thumb->resize(100,100);

$thumb->save('../images/thumb.jpg');

when I put this code into config/main.php, I get this messages:

b Fatal error: Uncaught exception ‘CException’ with message ‘Property “CWebApplication.phpThumb” is not defined.’ in C:\wamp\framework\base\CComponent.php on line 130

( ! ) CException: Property "CWebApplication.phpThumb" is not defined. in C:\wamp\framework\base\CComponent.php on line 130[/b]

Without this code I get another message:

move_uploaded_file(assets/pic/raw/24432_414865008596494_436127221_n.jpg): failed to open stream: No such file or directory

Help me! :blink:

Is there any option to compress the image?