Hi
I have noticed that nothing happen with GetStockImage.php and I want to pick up this thread again if you don't mind.
I have used various workarounds for a while to support both jpg and png for stock images but decided to try to find an easier way to check for this.
I ended up with this simple check to determine if its png, jpg or jpeg.
(Notice use of double parentheses to avoid php strict error for reset() if no files found causing missing parameter)
Code:
$imagefile = reset((glob($_SESSION['part_pics_dir'] . '/' . $StockID . '.{png,jpg,jpeg}', GLOB_BRACE)));
Then i have used $imagefile in what we kind of agreed to check for GD and if the file exist for GetStockImage.php and for use in the img link:
(Example from SelectProduct.php)
Code:
if (extension_loaded ('gd') && function_exists ('gd_info') && file_exists ($imagefile) ) {
if ($_SESSION['ShowStockidOnImages'] == '0') {
$StockImgLink = '<img src="GetStockImage.php?automake=1&textcolor=FFFFFF&bgcolor=CCCCCC'.
'&StockID='.urlencode($StockID).
'&text='.
'&width=100'.
'&height=100'.
'" alt="" />';
} else {
$StockImgLink = '<img src="GetStockImage.php?automake=1&textcolor=FFFFFF&bgcolor=CCCCCC'.
'&StockID='.urlencode($StockID).
'&text='. $StockID .
'&width=100'.
'&height=100'.
'" alt="" />';
}
} else {
if (isset ($StockID) AND file_exists ($imagefile) ) {
$StockImgLink = '<img src="' . $imagefile . '" height="100" width="100" />';
} else {
$StockImgLink = _('No Image');
}
}
FYI
I have also removed the comment slashes in GetStockImage.php line 5 as well as
line 52-58 as agreed.
Hope this can be implemented in the project soon.
But of course, support for png, jpg and jpeg just as a suggestion and a wish
There is a lot work to do in several scripts if this is interesting and i have some scripts ready for test.
FixedAssetItems.php, ContractBOM.php, SelectProduct.php, Stocks.php and SelectCategories.php
..and its working great with multiple image types.
Update:
Just finished the work and submitted all diff files to the project.
Jan