Show Part Picture (if available) Issue
|
09-09-2017, 07:22 AM
(This post was last modified: 09-09-2017 07:22 AM by VortecCPI.)
Post: #1
|
|||
|
|||
Show Part Picture (if available) Issue
If using the "#" symbol in a part number the "Show Part Picture (if available)" link does not work. I changed line 406 in SelectProduct.php
From this : echo '<a href="' . $RootPath . '/' . $imagefile . '" target="_blank">' . _('Show Part Picture (if available)') . '</a><br />'; To this: echo '<a href="' . $RootPath . '/' . str_replace('#', '%23', $imagefile) . '" target="_blank">' . _('Show Part Picture (if available)') . '</a><br />'; Though the ToolTip at Item Code states alpha-numeric only webERP accepted use of the "#" symbol in the Item Code. Perhaps we should add the "#" symbol to the list of prohibited characters? https://www.linkedin.com/in/eclipsepaulbecker |
|||
09-09-2017, 04:07 PM
Post: #2
|
|||
|
|||
RE: Show Part Picture (if available) Issue
I am not in a position to test it, but I think it should work by using urlencode($imagefile) instead of just $imagefile.
urlencode() should be used for all variables used in a URL. Tim |
|||
09-09-2017, 09:25 PM
Post: #3
|
|||
|
|||
RE: Show Part Picture (if available) Issue
(09-09-2017 04:07 PM)falkoner Wrote: I am not in a position to test it, but I think it should work by using urlencode($imagefile) instead of just $imagefile. Very interesting. I am only a novice PHP guy (at best) so I was unaware of this function. urlencode is used for $StockID elsewhere but not for the pictures in this case on lines 405 or 861. I will leave the solution up to you as opposed to beating and hacking the code into submission. Thank you for the insight. https://www.linkedin.com/in/eclipsepaulbecker |
|||
09-15-2017, 10:25 PM
(This post was last modified: 09-15-2017 10:42 PM by VortecCPI.)
Post: #4
|
|||
|
|||
RE: Show Part Picture (if available) Issue
I recently noticed pictures showed correctly for Work Order entry so I had a look at the code for showing pictures for each page.
Two comments: #1: Adding "$SupportedImgExt = array('png','jpg','jpeg');" on line 861 in SelectProducts.php fixed the issue. #2: The code to manage images here is a bit different and could likely be made more consistent if not the same. In an effort to be more consistent I chose to change the code at line 861 to match that found elsewhere in webERP: $SupportedImgExt = array('png','jpg','jpeg'); $imagefile = reset((glob($_SESSION['part_pics_dir'] . '/' . $myrow['stockid'] . '.{' . implode(",", $SupportedImgExt) . '}', GLOB_BRACE))); if(extension_loaded('gd') && function_exists('gd_info') && file_exists ($imagefile) ) { $StockImgLink = '<img src="GetStockImage.php?automake=1&textcolor=FFFFFF&bgcolor=CCCCCC'. '&StockID='.urlencode($myrow['stockid']). '&text='. //$myrow['stockid'] . '&width=100'. '&height=100'. '" alt="" />'; } else if(file_exists ($imagefile)) { $StockImgLink = '<img src="' . $imagefile . '" height="100" width="100" />'; } else { $StockImgLink = '<p>'._('No Image').'</p>'; } https://www.linkedin.com/in/eclipsepaulbecker |
|||
09-17-2017, 11:39 AM
Post: #5
|
|||
|
|||
RE: Show Part Picture (if available) Issue
Thanks - I've committed to SVN.
Phil Daintree webERP Admin Logic Works Ltd http://www.logicworks.co.nz |
|||
09-18-2017, 06:25 AM
Post: #6
|
|||
|
|||
RE: Show Part Picture (if available) Issue
(09-17-2017 11:39 AM)phil Wrote: Thanks - I've committed to SVN. Phil, Thank you so much for checking my work and for merging it back into the main source trunk. https://www.linkedin.com/in/eclipsepaulbecker |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 1 Guest(s)