Menu

#11 Converted images not displayed.

open-accepted
Internals (14)
5
2004-06-10
2004-06-08
Rex Vaughn
No

Images that are supposed to be converted are not displayed
(all non-original images).

This is problem since
v1.5 of showpic.php

The code:
$renamethis = "$convert $new_width $new_height
\"$cache_base\" \"$newalbum\" \"$source\" \"$dest\" 2>&1";
system(escapeshellcmd($renamethis));

causes the quotes to be escaped in the shell so
the command becomes:
./convert 100 67 \"cache\" \"2000,11,01-23
USSPortRoyal-Tahiti/LowResTahiti\"
\"/home/rvaughn/public_html/phpix3/albums/2000,11,01-23
USSPortRoyal-Tahiti/LowResTahiti/661B_007.jpg\"
\"cache/2000,11,01-23
USSPortRoyal-Tahiti/LowResTahiti/661B_007.jpg__scaled_100.jpg\"
2\>\&1

Replacing that code with the following accomplishes the
escapeshellcmd and allows for spaces in the directory
names:

$renamethis = escapeshellcmd("$convert $new_width
$new_height ").

"\"".escapeshellcmd($cache_base)."\" ".

"\"".escapeshellcmd($newalbum). "\" ".
"\"".escapeshellcmd($source).
"\" ".
"\"".escapeshellcmd($dest).
"\" 2>&1";
$last_line = system($renamethis);

Discussion

  • Rex Vaughn

    Rex Vaughn - 2004-06-08

    Logged In: YES
    user_id=165392

    Hmn... that does not work for filenames that have an '&' in
    it....
    the '&' is being double escaped.....

     
  • Rex Vaughn

    Rex Vaughn - 2004-06-09

    Logged In: YES
    user_id=165392

    Ok, this seems to work, it both properly converts the pictures
    and properly (I hope) escapes the special characters:

    $renamethis =
    escapeshellcmd("$convert $new_width $new_height ").

    escapeshellarg($cache_base). " ".

    escapeshellarg($newalbum). " ".

    escapeshellarg($source). " ".

    escapeshellarg($dest)." 2>&1";
    system($renamethis);

     
  • David Johnson

    David Johnson - 2004-06-10
    • assigned_to: nobody --> davemj
    • status: open --> open-accepted
     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.