Author Topic: Bug? Auto Size causes runtime error - unterminated string constant  (Read 2615 times)

0 Members and 1 Guest are viewing this topic.

Offline Alane808

  • album.pl User
  • *
  • Posts: 2
  • Karma: +0/-0
  • I forgot to change the default text
Hi there,
  Thank you so much for this great app.

  I think I may have found a bug. When you use "Auto" as the viewing option the program produces a Runtime Error:

Line 247
Error: Unterminated string constant

This appears in my album, as well as your online test-drive album.


Debug takes me to this line:

Code: [Select]
g_HTMLstring = '<img src="http://perl.Bobbitt.ca/sample_album/alejandra/10189819.jpg" border="0" title="File name    : /home/bobbitt/www/perl/sample_album/alejandra/10189819.jpg
File size    : 63904 bytes
File date    : 2004:11:28 00:10:28
Resolution   : 640 x 425
Jpeg process : Baseline
Comment      : Picture
Comment      : testing... ... ...Uploaded by alejandra.
Comment      :

 This is the last photo." width="' + resize.w_newPWidth +'"  height="' + resize.w_newPHeight + '"  />'
   document.write(g_HTMLstring);

Thanks,

Alane
« Last Edit: March 26, 2005, 11:40:53 by Mike Bobbitt »

Offline Mike Bobbitt

  • album.pl Author
  • Administrator
  • I Spend Too Much Time Here
  • *****
  • Posts: 3381
  • Karma: +35/-2
    • Mike's Development Archive
Re: Bug? Auto Size causes runtime error - unterminated string constant
« Reply #1 on: November 28, 2004, 17:52:14 »
Thanks for the note, I'll take a look and see if I can figure out what's going on here.


Cheers

Offline frister

  • album.pl Donor
  • album.pl Hacker
  • ****
  • Posts: 230
  • Karma: +42/-0
  • half baked ideas are better than none
    • fristersoft travelogue
Re: Bug? Auto Size causes runtime error - unterminated string constant
« Reply #2 on: November 28, 2004, 21:08:09 »
My script debugger is showing me this from the test-drive album:
Code: [Select]
g_HTMLstring = '<img src="http://perl.Bobbitt.ca/sample_album/1030/table2.JPG" border="0" title="File name    : /home/bobbitt/www/perl/sample_album/1030/table2.JPG
File size    : 55325 bytes
File date    : 2004:11:28 21:01:48
Resolution   : 639 x 480
Jpeg process : Baseline
Comment      : Table
Comment      : Look at the pretty tableUploaded by ln2ix.
Comment      :


 This is the last photo." width="' + resize.w_newPWidth +'"  height="' + resize.w_newPHeight + '"  />'
   document.write(g_HTMLstring);
This tells me that
a) jhead is enabled
b) the auto-sizing routine can't handle that. (Obviously, I didn't think of jhead output when I wrote it, since I don't use it.   :( )

J.J.

Offline frister

  • album.pl Donor
  • album.pl Hacker
  • ****
  • Posts: 230
  • Karma: +42/-0
  • half baked ideas are better than none
    • fristersoft travelogue
Re: Bug? Auto Size causes runtime error - unterminated string constant
« Reply #3 on: November 28, 2004, 22:39:02 »
Three work-arounds I can think of:

a) do not use jhead

b) do not provide the auto-size option if jhead is installed -- change
Code: [Select]
if ($::imagemagick)
{
if ($::textmenu)
{
$sizes_html.=$::S{339};
}
else
{
$sizes_html.="<img class=\"button\" src=\"$::auto_button\" title=\"$::S{339}\" />";
}
}
to
Code: [Select]
if ($::imagemagick && !$::jhead)
{
if ($::textmenu)
{
$sizes_html.=$::S{339};
}
else
{
$sizes_html.="<img class=\"button\" src=\"$::auto_button\" title=\"$::S{339}\" />";
}
}
c) turn off jhead output while auto-sizing -- change
Code: [Select]
if ($::jhead && $::photo)
{
$jhead_data=$::jhead_html;
}
to
Code: [Select]
if ($::jhead && $::photo && $::photo_width ne "auto" && $::photo_height ne "auto")
{
$jhead_data=$::jhead_html;
}

Of course, the best way would be to do character replacement in the jhead output so that java doesn't object to it.

J.J.

Offline Mike Bobbitt

  • album.pl Author
  • Administrator
  • I Spend Too Much Time Here
  • *****
  • Posts: 3381
  • Karma: +35/-2
    • Mike's Development Archive
Re: Bug? Auto Size causes runtime error - unterminated string constant
« Reply #4 on: December 02, 2004, 10:16:29 »
Good idea, if I get a few minutes I'll try to "java safe" the jhead output. Any idea what chars are bad?

Offline frister

  • album.pl Donor
  • album.pl Hacker
  • ****
  • Posts: 230
  • Karma: +42/-0
  • half baked ideas are better than none
    • fristersoft travelogue
Re: Bug? Auto Size causes runtime error - unterminated string constant
« Reply #5 on: December 03, 2004, 17:28:11 »
I suspect it's all the CR or CR LF stuff.  On the other hand, if you take them out, the text will end up as one long line that runns off the right of the browser.  :-\

J.J.

Offline Mike Bobbitt

  • album.pl Author
  • Administrator
  • I Spend Too Much Time Here
  • *****
  • Posts: 3381
  • Karma: +35/-2
    • Mike's Development Archive
Re: Bug? Auto Size causes runtime error - unterminated string constant
« Reply #6 on: December 03, 2004, 20:39:51 »
Hmmm, right... I wish there was a better way...!

Offline frister

  • album.pl Donor
  • album.pl Hacker
  • ****
  • Posts: 230
  • Karma: +42/-0
  • half baked ideas are better than none
    • fristersoft travelogue
Re: Bug? Auto Size causes runtime error - unterminated string constant
« Reply #7 on: December 03, 2004, 21:10:09 »
Maybe wrecking the jhead output format could be done only when auto sizing?....