Jump to content
  • Checkout
  • Login
  • Get in touch


The e-commerce.

NetPBM contrib


Recommended Posts

I have installed the NetPBM contrib.


I know NetPBM is working fine as I also use it on another part of our website and it works great there (same server).


But when I try and use it with OSC the image files are written to the images directory but they are all "0" byte files. I have even went as far as chmodding the images directory to 777 but still no luck.


Any ideas?



Link to comment
Share on other sites

I have even tried to put the direct path in the image_resample.php file with no luck.




 osCommerce, Open Source E-Commerce Solutions


 Copyright (c) 2002 osCommerce

 Released under the GNU General Public License



 The filename for the generated image needs to be different since we 

 don't want to change the original. Meaning you can alter size in admin 

 and get new resamples from the original.


 REQUIRES netpbm and netpbm-progs in path

 Made and tested on Linux RH7.3


 -J?rg (jorg-osc@omnimedia.no)


// the name of the resampled image

$file = eregi_replace( '.([a-z]{3,4})$', "-{$width}x{$height}.1", $src );

// if this file does not exist, then make it

if( !is_file( $file ) ) {

 $src = DIR_FS_CATALOG . '/' . $src;  // original picture to be resized

 $dst = DIR_FS_CATALOG . '/' . $file;  // name of the resamplee (ie. pathimage-78x88.jpg )

 $i = getimagesize( $src ); 	 // need to know type

   switch ( $i[2] ) {

    case 3: // PNG

$cmd = "/usr/local/netpbm/bin/pngtopnm '$src'|/usr/local/netpbm/bin/pnmscale -xysize $width $height|/usr/local/netpbm/bin/ppmquant 255|/usr/local/netpbm/bin/pnmtopng $trans > '$dst'";


    case 1: // GIF

$cmd = "/usr/local/netpbm/bin/giftopnm '$src'|/usr/local/netpbm/bin/pnmscale -xysize $width $height|/usr/local/netpbm/bin/ppmquant 255|/usr/local/netpbm/bin/ppmtogif $trans > '$dst'";


    case 2: // JPG  

$cmd = "/usr/local/netpbm/bin/djpeg '$src'|/usr/local/netpbm/bin/pnmscale -xysize $width $height|/usr/local/netpbm/bin/cjpeg -quality 90 > '$dst'";



  $res = exec( $cmd ); // Do the actual operation


$src = $file; 	 // Use the resampled image

$width = $height = ""; // and it's own properties



What the heck could be causing this to write a "0" byte file for each image?


I'm pulling my hair out.


Thanks for ANY suggestions you can provide.

Link to comment
Share on other sites

  • 2 weeks later...

I had no luck with it either. I spent a long time on this one and tried breaking it down into three seperate operations instead of piping the output and still no luck. I had two thoughts:

I wondered whether the problem had to do with memory allocation and the piping was using up too much.

I thought file protection errors could have caused the zero byte file but this seemed unlikely

Link to comment
Share on other sites

  • 4 months later...
  • 4 weeks later...

i have some problems because of safemode=On. I don't want to turn the safemode off.

Can some1 help me with configuring it right, so it will run in safemode=On also?


For now i was adding safe_mode_exec = /path to my php.ini

in /path are all netpbm-progs and the image_resample.php now

i changed the include line in html_output.php to the new /path


but it is still not working in safemode :(


Need some help with it.





Link to comment
Share on other sites

  • 9 months later...

I'm having a problem, it's quite strange really. Sort of the reverse of the one above.


I've got an old copy of TEP installed and running the older version of this contrib, but i want to replace my site with a fresh install of OSC. So i've installed it on the same system, which is converting images under tep perfectly. The new install of this contrib on the fresh osc install is generating the resampled image file, but the page doesnt display any image, at all. I can't figure this one out, so, er, help? :)


The generated file is fine, i can put in the direct url to it and it works perfectly.

Link to comment
Share on other sites

Oh, and just to clarify. It only seems to be an issue in product_info. I've put the original product_info.php back in place as i had edited it, but this still makes no difference.

Link to comment
Share on other sites

It's definate image data, however i've just 'fixed' it, basically I just downloaded the old copy, and it's working fine. I dont get it, but as long as it works i'm happy :D

Link to comment
Share on other sites


This topic is now archived and is closed to further replies.

  • Create New...