Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I'm using from several months wt-resize, a script to resize images on the fly. It works very well until now...

I've changed hosting provider. I'm using now Centos 6.3 (no control panel) + Litespeed (php 5.4.11) and i have following errors:

Warning: getimagesize() expects parameter 1 to be string, object given in     /home/*****/***/
 Warning: basename() expects parameter 1 to be string, object given in /home/

According source page where i see this error it seems that this script isn't able anymore to return the name of the file.

Do you have any workaround ?

I'm asking about this script because Wordpress doesn't resize images on the fly. If you add to functions.php a new size, for example

add_image_size( 'archivio', 250, 140, true ); 

you resize every single image you upload online to the size 250x140 and i'm interested only to resize what i want

Here's the error i have on the source page where i'm using this script

 <b>Warning</b>:  getimagesize() expects parameter 1 to be string, object given in       <b>/home/***/public_html/wp-content/themes/***-v16/functions.php</b> on line <b>139</b><br   />
 <br />
 <b>Warning</b>:  basename() expects parameter 1 to be string, object given in
 <b>/home/***/public_html/wp-content/themes/***-v16/functions.php</b> on line <b>140</b>
 <br />
 <img src="http://www.***.com/images/2013/02/" width="" height="" />
</a>

For reference: https://gist.github.com/seedprod/1367237/raw/acf4a2987ff07da6135ac2a91df5532b855ccb46/vt_resize.php

More details:

Previous server configuration was Centos 6.3 + Nginx + PHP 5.3.2.1. I can confirm this script was working well :(

share|improve this question
    
Do you use the same Versions of WordPress on both Setups? Do you have the same Directory Permissions set for your System? –  fischi Feb 12 '13 at 10:29
    
1)Do you use the same Versions of WordPress on both Setups? Yes, latest wp available for download 2)Do you have the same Directory Permissions set for your System? * No. WIth virtualmin i was using standard user. Now i'm using ftpuser:nobody for files inside public_html –  matthew79US Feb 12 '13 at 10:33
add comment

1 Answer

The Problem here lies within the Plugin, which utilizes the deprecated Function image_resize. I'm not 100% sure that this is the only Problem, but try rewriting the Plugin using the new [WP_Image_Editor][1] Class.

The next Step to check is if the Plugin can write the files, and if the directory permissions are set correctly.

See Line 128 of your code:

$new_img_path = image_resize( $file_path, $width, $height, $crop );         

This line returns a String if executed correctly, or an WP_Error Object on Failure. I'm pretty sure this is where your Plugin goes wrong.

If you do not want to rewrite it (which I highly recommend), try writing a small Plugin to find out if your image_size works as expected, or if you have to change your Server's settings.

For the Image functions to work, you have to have your Uploads Directory writeable for your Plugin Files.

share|improve this answer
    
wow thanks for reply :) Unfortunately i know only how to setup a server, permissions and so on but i don't know nothing about php programming. Your reply is illuminating. It means i must search some workaround because without this function = more mess on hdd (hundred images never used) :) –  matthew79US Feb 12 '13 at 10:37
    
The function image_resize actually saves the Thumbnail into your Uploads directory, you are aware of that, aren't you? –  fischi Feb 12 '13 at 10:40
    
I'm aware what you are saying about this function 100% but i confirm i was using this functions for a different url (i'm saving the images from years on mysite.com/images.) and worked well since last year (october). pastebin.com/fFtVBGHP (sry, too much long for a cut & paste there) –  matthew79US Feb 12 '13 at 10:43
    
Okay, nice. just wanted to point it out :) –  fischi Feb 12 '13 at 10:45
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.