My site used to work just fine but I have adjusted a few small things, such as adding a htaccess file to fix urls etc. Now I have noticed my graphs do not display on my site.
This is the page in question:
When you visit the graph directly through a URL like this:
You get this error:
JpGraph Error: HTTP headers have already been sent. Caused by output from file products.php at line 1. Explanation: HTTP headers have already been sent back to the browser indicating the data as text before the library got a chance to send it's image HTTP header to this browser. This makes it impossible for the library to send back image data to the browser (since that would be interpretated as text by the browser and show up as junk text). Most likely you have some text in your script before the call to Graph::Stroke(). If this texts gets sent back to the browser the browser will assume that all data is plain text. Look for any text, even spaces and newlines, that might have been sent back to the browser.
For example it is a common mistake to leave a blank line before the opening "<?php".
According to the error it says that it is my product.php which looks like this:
<br />
<div class="row">
<div class="span3" style="text-align: center;">
<a class="fancybox" href="<?=$product_data['pLargeImage']?>"><img src="<?=$product_data['pMediumImage']?>" alt="<?=htmlspecialchars($product_data['pTitle'])?>" /></a>
<br />
<span class="small-and-grey">Click image for larger version</span>
</div>
<div class="span6">
<h1 class="product-title"><?=htmlspecialchars($product_data['pTitle'])?></h1><br />
<strong>ASIN</strong> <span class="double-arrow"></span> <?=$asin?>
<?php if (isset($product_data['pManufacturer']) && $product_data['pManufacturer'] != ''): ?>
<br /><strong>Manufacturer</strong> <span class="double-arrow"></span> <?=$product_data['pManufacturer']?>
<?php endif; ?>
<?php if (isset($product_data['pMpn']) && $product_data['pMpn'] != '' && $product_data['pMpn'] != '0'): ?>
<br /><strong>MPN</strong> <span class="double-arrow"></span> <?=$product_data['pMpn']?>
<?php endif; ?>
<br /><strong>Category</strong> <span class="double-arrow"></span> <?=$product_data['pCategory']?>
<?php if (isset($product_data['pEan']) && $product_data['pEan'] != '' && $product_data['pEan'] != '0'): ?>
<br /><strong>EAN</strong> <span class="double-arrow"></span> <?=$product_data['pEan']?>
<?php endif; ?>
</div>
<div class="span3">
<div class="current-prices pull-right">
<?php foreach ($history_data as $id => $row): ?>
<div class="flag-price">
<div class="pull-left">
<a href="<?=htmlspecialchars($row['rAffiliateLink'])?>" rel="nofollow"><img src="<?=base_url() . "img/site/flags/" . $row['rCode']?>.jpg" alt="Amazon <?=$row['rCode']?>"/></a>
</div>
<div class="pull-right">
<a href="<?=htmlspecialchars($row['rAffiliateLink'])?>" rel="nofollow"><?=$row['hRecordedPriceFormatted']?></a>
</div>
</div>
<?php endforeach; ?>
</div>
<div class="small-and-grey pull-right">Click flag to buy direct from Amazon.</div>
</div>
</div>
<br />
<div class="tab-container">
<ul class="nav nav-tabs">
<li class="active">
<span>Overview</span>
</li>
</ul>
<div class="tabbed-data-container">
<div class="row">
<div class="graph-container"><img src="<?=base_url()?>graph/<?=$asin?>/3months" style="width:650px;height:600px;" alt="Item history"/></div>
<div class="span3 pull-right">
<br /><br /><br /><br /><br />
<div class="graph-info">
<span class="title">Please Note:</span><br /><br />
Product prices and availability are accurate as of the date/time indicated and are subject to change.
<br /><br />
The graph will always display the recorded price converted to GBP.
<br /><br />
Converted GBP prices are approximated based on the current exchange rate at the point of being recorded.
</div>
<!--
<div style="margin:20px;margin-left: 0;padding:20px;border:1px solid #ddd;">
<div class="controls">
<label class="radio">
<input type="radio" name="optionsRadios" id="optionsRadios1" value="option1" checked="">
Europe
</label>
<label class="radio">
<input type="radio" name="optionsRadios" id="optionsRadios2" value="option2">
UK Only
</label>
</div>
<br /><br />
<div class="controls">
<label class="radio">
<input type="radio" name="optionsRadios" id="optionsRadios2" value="option1" checked="">
6 Months
</label>
<label class="radio">
<input type="radio" name="optionsRadios" id="optionsRadios2" value="option2">
All time
</label>
</div>
</div>
-->
</div>
</div>
</div>
</div>
<br />
<div class="tab-container">
<ul class="nav nav-tabs">
<li class="active">
<a href="#price_history" data-toggle="tab">Price History</a>
</li>
<!--
<li>
<a href="#price_history" data-toggle="tab">Price History</a>
</li>
-->
</ul>
<div class="tabbed-data-container tab-content">
<div class="tab-pane fade in active" id="price_history">
<table class="table table-striped">
<thead>
<tr>
<th>Region</th>
<th style="text-align:right;">Latest Price</th>
<th style="text-align:right;">Last Change</th>
<th style="text-align:right;">Cheapest Price</th>
</tr>
</thead>
<tbody>
<?php foreach ($history_data as $id => $row): ?>
<tr>
<td><img src="<?=base_url() . "img/site/flags/" . $row['rCode']?>.jpg" alt="Amazon <?=$row['rCode']?>"/> <?=$row['rName']?></td>
<td style="text-align:right;"><?=$row['hRecordedPriceFormatted']?>
<span class="grey">(<?=(isset($row['hConvertedGbpPriceFormatted'])) ? $row['hConvertedGbpPriceFormatted'] : '-';?>)</span>
<br /><span class="small-and-grey"><?=$row['hCreatedFormatted']?></span>
</td>
<td style="text-align:right;">
<?php if ($row['hLastChangeValue'] > 0) echo '<i class="icon-price-up"></i>';?>
<?php if ($row['hLastChangeValue'] < 0) echo '<i class="icon-price-down"></i>';?>
£ <?=($row['hLastChangeValue'] != 0) ? $row['hLastChangeValue'] : '-';?>
<span class="grey">(<?=($row['hLastChangePercent'] != 0) ? $row['hLastChangePercent'] . ' %' : '-';?>)</span>
<br /><span class="small-and-grey"><?=$row['hLastChangeDateFormatted']?></span>
</td>
<td style="text-align:right;"><?=$row['hCheapestPriceFormatted']?>
<span class="grey">(<?=(isset($row['hCheapestConvertedGbpPriceFormatted'])) ? $row['hCheapestConvertedGbpPriceFormatted'] : '-';?>)</span>
<br /><span class="small-and-grey"><?=$row['hCheapestDateFormatted']?></span>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
<!--
<pre><?php //print_r($history_data);?></pre>
<div class="tab-pane" id="price_">
</div>
-->
</div>
</div>
<br />
<div class="tab-container">
<ul class="nav nav-tabs">
<li class="active">
<span>Comments</span>
</li>
</ul>
<div class="tabbed-data-container" style="padding-left: 10px; padding-right: 10px;">
<br />
<div id="disqus_thread"></div>
<script type="text/javascript">
/* * * CONFIGURATION VARIABLES: EDIT BEFORE PASTING INTO YOUR WEBPAGE * * */
var disqus_shortname = 'hugeriver'; // required: replace example with your forum shortname
/* * * DON'T EDIT BELOW THIS LINE * * */
(function() {
var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js';
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
})();
</script>
</div>
Would anyone tell me what might be causing this to suddenly stop working?