Monthly Archives: July 2012

WordPress FTP prompt for Upgrade or Update

There are a lot of posts around about the FTP prompt when preparing an upgrade and all (almost all) reference the same information which is to enter specific settings in the wp-config.php file for the FTP site, username, & password.

Alternatively, I prefer this option which allows the admin user with the correct permissions to avoid the FTP aspect altogether.

In the same wp-config.php file in the WordPress root, around line 10 it will look like this:

[php]
* This file is used by the wp-config.php creation script during the
* installation. You don’t have to use the web site, you can just copy this file
* to "wp-config.php" and fill in the values.
*
* @package WordPress
*/

// ** MySQL settings – You can get this info from your web host ** //
[/php]

Just insert a few lines and add the 3 DEFINE lines as per the example below:

[php]
* This file is used by the wp-config.php creation script during the
* installation. You don’t have to use the web site, you can just copy this file
* to "wp-config.php" and fill in the values.
*
* @package WordPress
*/
define(‘FS_METHOD’, ‘direct’);
define( ‘FS_CHMOD_DIR’, 0775 ); // change these settings to match your apache account
define( ‘FS_CHMOD_FILE’, 0664 ); // change these settings to match your apache account

// ** MySQL settings – You can get this info from your web host ** //
[/php]

The key is the CHMOD entries. In my case the cpanel / WHM server is configured for the apache account to act as the group controller of the files. So to upload and modify files in the Worpress directory it needs write permissions as group not owner.

osCmax 2.5 thumbnail images not showing after upload case sensitive on Linux

The issue here was that loading some images as extra’s were not appearing as thumbnails in the product display. At least some of them were not. The key was that the ones that worked had a lower case file extension and the ones that did not had upper letters. i.e. .jpg and .JPG

I tracked this to being that the Dynamic Mopics for extra product images is case sensitive. Loading an image from another system (Windows perhaps?) with an upper case .JPG extension will not display the thumbnail without specifying the upper case extension in the admin settings for Dynamic Mopics which has all lower case extensions by default.

Using the default installation admin settings. Load a main product image and an extra jpg type file image with the extension as uppercase .JPG
Using the catalog user view inspect the product and there are no thumbnails displayed.
Modify the admin setting to include JPG (as distinct from jpg) in the viewable formats and the images display.

A simple fix is to force lower case extensions for all image uploads. This is a simple change.

Edit the file catalogadminincludesmodulesproduct_image_upload.php

line 23
[text] $ext = substr(strrchr($main_image, ‘.’), 0);[/text]
becomes
[text] $ext = strtolower(substr(strrchr($main_image, ‘.’), 0));[/text]
(adding the additional function as a wrapper, do not forget the closing parenthesis)

Updating an existing database is also relatively simple in phpMyAdmin or similar select the products table and run the following:
[text]UPDATE products SET products_image = REPLACE(products_image, ‘.JPG’,’.jpg’);[/text]

if the user wants to test the impact of this first display the table with the changes with:
[text]SELECT `products_id`, REPLACE(products_image, ‘.JPG’,’.jpg’) AS ‘products_image’ FROM products;[/text]