Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

the netpbm contribution


Guest

Recommended Posts

  • 3 weeks later...

/* file image_resample.php Also change html_output as in ntpbm contribution */

 

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

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

$oldwidth= $i[0];

$oldheight = $i[1];

// no support for gif in recent versions

if ( ($i[2] == 3) || ($i[2] ==2)) {

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

if( !is_file( $file ) ) {

$dst = DIR_FS_CATALOG . '/' . $file; // name resampled (eg. pathimage-78x88.jpg )

$im = @imagecreatetruecolor ($width, $height); // create blank thumbnail

if ( $i[2] == 2) {

$oldim = @ImageCreateFromJPEG ($src); // Attempt to open large image

imagecopyresampled ($im, $oldim, 0, 0, 0, 0, $width, $height, $oldwidth, $oldheight); // mk thumb

imagejpeg ($im , $dst , 90); // save it compressed

}

elseif ( $i[2] == 3) {

$oldim = @ImageCreateFromPNG ($src); // Attempt to open large image

imagecopyresampled ($im, $oldim, 0, 0, 0, 0, $width, $height, $oldwidth, $oldheight); // mk thumb

imagepng ($im , $dst); // save it

}

}

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

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

}

Link to comment
Share on other sites

The above post shows how I got it working but without netpbm. Simply replace the file 'image_resample.php' in the contribution with this one The other difference is of course the lack of gif support in recent versions.

Let me know if you try it.

hth

Link to comment
Share on other sites

  • 1 month later...
The above post shows how I got it working but without netpbm. Simply replace the file 'image_resample.php' in the contribution with this one The other difference is of course the lack of gif support in recent versions.

Let me know if you try it.

hth

 

I seem to be having a problem getting the NetPBM contrib working even though NetPBM is installed corectly and work in other areas of our website:

 

http://www.oscommerce.com/forums/viewtopic.php?t=32864

 

So I thought I would give your fix a try. After replacing your code with the current image_resample.php code when I laod my stores page as soon as the first thumbnail is called (on the left side of the page) from then on the page is totally blank.

 

Any ideas?

Link to comment
Share on other sites

  • 3 months later...

Hi radders!

 

Will this mod work like the Netpbm one? I'm a little confused. I would like to be able to attach one file (largest size) to my products, and then have it displayed as two thumbnail sizes, small and medium.

 

Is this what this mod does?

 

If not, could you please post a site showing what effect this has on images. I followed the instructions to update the code for both html_output.php and image_resample.php to a T and I don't see anything happening. Probably doing something wrong.

 

Maybe I should post the contents of image_sample.php and html_output.php?

 

Thanks for your help!

 

Steve

Link to comment
Share on other sites

  • 1 month later...
  • 1 month later...

Archived

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

×
×
  • Create New...