Unwanted line break
Posted: 23 June 2008 03:22 PM   [ Ignore ]
Newbie
Rank
Total Posts:  8
Joined  2007-03-22

I’m not sure if this is because of the File extension, but it’s one possible cause, so here goes. I’m working on a photo gallery based largely on some work Ingmar Greil did, discussed in this thread. I mention this so you’ll know I’m not a whiz at php, just working at the cut-and-paste level.  smirk The problem that I’m having is that the rendered code sometimes breaks into a new line immediately after the image name. I’ve tried a bunch of different things, including uploading a few different files and sometimes it breaks, sometimes it doesn’t. I haven’t been able to figure out why. Here’s the code I’m using in the template:

<div id="prevnext">
{exp:weblog:next_entry}
<?php $path
= explode('/','{id_path="lakes/photo"}'); $id = $path[count($path)-2];

$query2 = "SELECT field_id_4 AS image_next FROM exp_weblog_data WHERE entry_id = $id";
$result2 = mysql_query($query2,$db); $image = mysql_result($result2,0,"image_next");
?>

<div id="next"><span class="thumb"><em style="background-image:url('thumb/phpThumb.php?src=/photos/images/uploads/<?php echo $image;?>&amp;w=<?php if ($height>$width) { echo ('67');} else {echo ('89');} ?>');"><a href="{id_path="lakes/photo"}" accesskey="x" style="background:#fff;"></a></em></span></div>

{/exp:weblog:next_entry}

{exp
:weblog:prev_entry}
<?php $path
= explode('/','{id_path="lakes/photo"}'); $id = $path[count($path)-2];

$query1 = "SELECT field_id_4 AS image_prev FROM exp_weblog_data WHERE entry_id = $id";
$result1 = mysql_query($query1,$db); $image = mysql_result($result1,0,"image_prev");
?>

<div id="prev"><span class="thumb"><em style="background-image:url('thumb/phpThumb.php?src=/photos/images/uploads/<?php echo $image;?>&amp;w=<?php if ($height>$width) { echo ('67');} else {echo ('89');} ?>');"><a href="{id_path="lakes/photo"}" accesskey="x" style="background:#fff;"></a></em></span></div>

{/exp:weblog:prev_entry}

Here’s an example of rendered code, where you can see the line break after the jpg:

<div id="next"><span class="thumb"><em style="background-image:url('thumb/phpThumb.php?src=/photos/images/uploads/244497-2.jpg

&w=89');"
><a href="http://www.mysite.org/photos/index.php?/lakes/photo/3/" accesskey="x" style="background:#fff;"></a></em></span></div>

I’ve spent hours on this today and cannot figure out what could be causing those random line breaks. Has the File Extension ever been known to add spaces or other hidden characters to the file names on upload? Any other ideas?

Profile
 
 
Posted: 25 June 2008 01:08 PM   [ Ignore ]   [ # 1 ]
Newbie
Rank
Total Posts:  8
Joined  2007-03-22

Ack, I’m so embarrassed!!! red face I’m actually using Mark Huot’s File extension on the site in question, not your File Upload module, so the whole question is irrelevant. So sorry! Please feel free to delete the whole question - I got my “Files” confused!

Profile
 
 
Posted: 26 June 2008 05:55 AM   [ Ignore ]   [ # 2 ]
Administrator
Avatar
RankRankRankRank
Total Posts:  3374
Joined  2006-10-18

Haha, good! Less work for me! rasberry

 Signature 
Profile