Author Topic: If you have selected "NetPBM", enter path  (Read 11944 times)

0 Members and 1 Guest are viewing this topic.

Offline suzkaw

  • Pre-Newbie
  • Posts: 8
    • View Profile
If you have selected "NetPBM", enter path
« on: August 29, 2002, 04:58:48 PM »
On this line in settings I can't figure out what my path is.

I have tried
http://skgastonia.com/netPBM
/public_html/netPBM
/skgaston/public_html/netPBM
/netPBM

But it always give me the error
NetPBM error. Wrong path or NetPBM not installed.
Check module settings.

Has anyone else had this problem or am I doing something wrong?

Thanks,
Eric

Offline Jan

  • Administrator
  • 4images Guru
  • *****
  • Posts: 5.024
    • View Profile
    • 4images - Image Gallery Management System
If you have selected "NetPBM", enter path
« Reply #1 on: August 29, 2002, 05:02:30 PM »
It's not enough to upload the files. You have install NetPBM with root access ;)

Jan
Your first three "must do" before you ask a question:
1. Forum rules
2. FAQ
3. Search

Offline suzkaw

  • Pre-Newbie
  • Posts: 8
    • View Profile
If you have selected "NetPBM", enter path
« Reply #2 on: August 29, 2002, 06:23:31 PM »
Awe Man  :(
Is there any out there that you don't have to have root access.

Thanks,
Eric

Offline Jan

  • Administrator
  • 4images Guru
  • *****
  • Posts: 5.024
    • View Profile
    • 4images - Image Gallery Management System
If you have selected "NetPBM", enter path
« Reply #3 on: August 29, 2002, 06:35:04 PM »
Try if GD works. Most Hosts have installed this module.

Jan
Your first three "must do" before you ask a question:
1. Forum rules
2. FAQ
3. Search

Offline suzkaw

  • Pre-Newbie
  • Posts: 8
    • View Profile
If you have selected "NetPBM", enter path
« Reply #4 on: August 29, 2002, 06:44:26 PM »
Thank You, Thank You, Thank You,
You are a GENIOUS!  :lol:

No but really thanks for the suggestion it worked with GD.

Offline bernd

  • Full Member
  • ***
  • Posts: 214
    • View Profile
If you have selected "NetPBM", enter path
« Reply #5 on: August 30, 2002, 02:59:50 PM »
Quote from: Jan
It's not enough to upload the files. You have install NetPBM with root access ;)


Sorry Jan but that is just not true. If you go to the Sourceforge Gallery homepage you can download pre-compiled NetPBM binaries (http://sourceforge.net/project/showfiles.php?group_id=7130 - pick your platform) and just put 'em in your webdirectory. Make them executable and put the path to them into the 4images control panel - that's it.

cheers,
Bernd

Offline fastnsilver

  • Pre-Newbie
  • Posts: 4
    • View Profile
    • http://fastnsilver.mine.nu
Still having troubles
« Reply #6 on: September 07, 2002, 06:52:57 PM »
First off, I host my own website, so I have root access.

My website platform
- Windows XP Pro
- Apache 1.3.26
- PHP 4.2.2
- MySQL 3.23.49

I have downloaded and installed the NetPBM Win32 pre-compiled binaries from the Gallery website.  In fact, what I'm trying to do is migrate my photo albums from this package to 4Images.  So, I know that the version of NetPBM I have works when resizing images or creating thumbnails.  Check out http://fastnsilver.mine.nu/gallery to see proof that I'm not lying.

However, NetPBM fails to work for my 4Images install. I have installed version 1.7 of 4Images Gallery.
Every time I try to create a thumbnail I get a message like...

Create thumbnail for: 122 2237 IMG (122_2237_IMG.jpg) ....  
   Error creating thumbnail!

Upon checking the Apache error log I see...

'c:\netpbm\bin' is not recognized as an internal or external command,
operable program or batch file.


I have tried a number of combinations for the NetPBM path

c:\netpbm\bin
\netpbm\bin  << this wouldn't work anyway but I had to try
g:\wwwroot\bin  << wwwroot is my webserver's root directory

all result in the above errors.

So then, I thought "hmmm" let me check to the source code to see if the path is getting set correctly.

The two places I looked were

/admin/thumbnailer.php
/includes/image_utils.php

But I'm really a novice when it comes to debugging PHP.

Any ideas how to proceed?

Thanks!
(a would-be 4Images convert)

Offline fastnsilver

  • Pre-Newbie
  • Posts: 4
    • View Profile
    • http://fastnsilver.mine.nu
Further research
« Reply #7 on: September 07, 2002, 07:57:08 PM »
After poking around the source and expirementing I think I've narrowed down where the problem is...

in /includes/image_utils.php  there's a function specific to resizing images with netpbm

function resize_image_netpbm($src, $dest, $quality, $width, $height, $image_info) {
  global $convert_options;

  $convert_path = $convert_options['convert_path'];
  $types = array(1 => "gif", 2 => "jpeg", 3 => "png");
  $target = ($width > $height) ? $width : $height;
  $command = $convert_path."/".check_executable($types[$image_info[2]]."topnm")." ".$src." | ".$convert_path."/".check_executable("pnmscale")." --quiet -xysize ".$target." ".$target." | ";
  if ($image_info[2] == 1) {
    $command .= $convert_path."/".check_executable("ppmquant")." 256 | " . $convert_path."/".check_executable("ppmtogif")." > ".$dest;
  }
  elseif ($image_info[2] == 3) {
    $command .= $convert_path."/".check_executable("pnmtopng")." > ".$dest;
  }
  else {
    $jpeg_exec = (file_exists($convert_path."/".check_executable("pnmtojpeg"))) ? check_executable("pnmtojpeg") : check_executable("ppmtojpeg");
    $command .= $convert_path."/".$jpeg_exec." --quality=".$quality." > ".$dest;
  }
  system($command);
  return (file_exists($dest)) ? 1 : 0;
}

Somehow on Windows platforms the "/" is causing the $command function to truncate before executing the .check_excutable piece of the code.  Does that make sense?

See my earlier comment about the error thrown in the Apache error log file... the program or batch file it's trying to execute is just the path... not the path plus the executable as it should be.

How can I unescape the "/" to turn it into a "\"  as Windows wants a full path to the executables?

Offline fastnsilver

  • Pre-Newbie
  • Posts: 4
    • View Profile
    • http://fastnsilver.mine.nu
Even More Info
« Reply #8 on: September 07, 2002, 08:56:15 PM »
Ok... I added an echo line in image_utils.php for the resize_image_netpbm function.

Here's some sample output

c:\netpbm\bin/jpegtopnm.exe ./../data/media/6/122_2237_IMG.jpg | c:\netpbm\bin/pnmscale.exe --quiet -xysize 100 100 | c:\netpbm\bin/ppmtojpeg.exe --quality=75 > ./../data/thumbnails/6/122_2237_IMG.jpg


Clearly, Windows is barfing on the combination of / and \.  As well, the constant defined for ROOT_PATH is probably causing problems too.

My thought is to use the $DOCUMENT_ROOT PHP variable for the ROOT_PATH instead of ./../.

But I still have the problem of escaping the \ character.

I've also tried changing the path to the netpbm to

c:\\netpbm\\bin
c:/netpbm/bin

all to no avail.  Is this problem just related to Windows?

How do you get the output of a system call?  I hink this would help me debug the problem.

Please help!

Offline fastnsilver

  • Pre-Newbie
  • Posts: 4
    • View Profile
    • http://fastnsilver.mine.nu
Got It!
« Reply #9 on: September 07, 2002, 10:45:53 PM »
After much frustration and expirementation I finally figured out what I had to do.  I think the solution I came up with is a bug fix for proper Windows support.

change line the system($command) line in function resize_image_netpbm() inside the /includes/image_utils.php file to be

if (substr(PHP_OS, 0, 3) == "WIN"){
    $command = ereg_replace("/", "\\", $command);
    exec("cmd.exe /c $command");
  }
  else {
    system($command);
  }

this checks the OS and then uses a regular expression to replace all occurences of "/ to "\".

You must enter the NetPBM path as something like...

<drive letter>:/path/to/netpbm/bin

I'm so freakin' happy I fixed this myself!  :D

Offline Dan1113

  • Jr. Member
  • **
  • Posts: 72
    • View Profile
If you have selected "NetPBM", enter path
« Reply #10 on: September 08, 2002, 04:09:15 AM »
Wow, congrats! :)

Offline bc

  • Newbie
  • *
  • Posts: 31
    • View Profile
If you have selected "NetPBM", enter path
« Reply #11 on: December 23, 2002, 09:36:37 AM »
Good grief, I was looking at all these support instances for NetPBM because I had a very similar configuration (winXP, apache 1.3.27, php 4.2.3, mysql 3.23.49) and had the exact same problem.

Bingo. fastnsilver hit the problem on the spot.