Image file not loading |
Image file not loading |
tudsy |
Jan 18 2017, 08:38 AM
Post
#1
|
Advanced Member Group: Members Posts: 246 Joined: 30-September 14 Member No.: 21,611 |
Hi
I am trying to assign prices (a number) to each bmp file. At the moment, the sound is loading correctly but the image is not. The code is shown below. Any help will be appreciated. Thanks. <!DOCTYPE html> <html> <head><meta http-equiv="Content-Type" content="text/html; charset=windows-1252"> <script> (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) })(window,document,'script','https://www.google-analytics.com/analytics.js','ga'); ga('create', 'UA-908952-3', 'auto'); ga('send', 'pageview'); ga('require','linkid'); </script> <script> var personsnamejs ='AdrianTudini'; var personpicture = personsnamejs + '.jpg'; var personpath = 'http://103.226.223.161/~ecovibdc/ECOVIB2D/MYART/' + personsnamejs + '/' + personpicture; function setvar(){ var x = document.getElementById('Title'); x.style.color = '#00FF00'; x.style.fontSize ='36px'; document.getElementById('PersonImage').src = personpath; var z = document.getElementById('PlaySound'); z.style.color = '#00FF00'; z.style.fontSize ='24px'; var t = document.getElementById('paypal'); t.style.color = '#00FF00'; t.style.fontSize ='24px'; var u = document.getElementById('freename'); u.style.color = '#00FF00'; u.style.fontSize ='20px'; var v = document.getElementById('freeaddress'); v.style.color = '#00FF00'; v.style.fontSize ='20px'; document.getElementById('def').innerHTML = 'Click-Tap dropdown menu to view/select ' + personsnamejs + " 's Art"; document.getElementById('PersonImage').src = personpath; document.getElementById('paypal').innerHTML ="* Your name and email address will not be sold or traded."; }; </script> <script type='text/javascript'> function linkSound(picname,personname) { if(picname != 'default') { soundfile = picname.replace('w.bmp','.mp3'); var soundfilepath = 'http://103.226.223.161/~ecovibdc/ECOVIB2D/MYART/' + personname + '/Sound/' + soundfile; document.getElementById('Sound').src = soundfilepath; } };</script> <script> function changePic(picname,personname) { if(picname != 'default') { var path = 'http://103.226.223.161/~ecovibdc/ECOVIB2D/MYART/' + personname + '/Graphic/' + picname; var myimg = document.getElementById('myImage'); var newImage = new Image(); newImage.src = path; newImage.onerror = function() { alert('There was a problem loading the Image file! - Please try again'); myimg.style.height = ''; myimg.src = ''; } newImage.onload = function() { myimg.src = path; var y = document.getElementById('Price'); y.style.color = '#00FF00'; y.style.fontSize ='36px'; document.getElementById('Price').innerHTML= 'Price of Art ( without a watermark )(USD): $' + Priceofart; document.getElementById('form').action = "process.php?username=<?php echo $Name ?>&email=<?php echo $Email ?>"+ "&Person=" + personsnamejs + "&Price=" + Priceofart + "&Graphic=" + picname.replace('w.bmp','.bmp'); } } }; </script> <title>ECOVIB2D©</title> </head> <body onload='setvar();' style='background-color: #660000'> <table align='centre' border='0' width='965'> <tbody> <tr> <td bgcolor='#660000' width='189px'><img height='90' src='http://103.226.223.161/~ecovibdc/ECOVIB2D/MYART/ecovib2d1.jpg' width='90' /></td> <td bgcolor='#660000' width='500px'> <p align='center' id ='Title'>ECOVIB2D©</p> <div id='google_translate_element'></div><script type='text/javascript'> function googleTranslateElementInit() { new google.translate.TranslateElement({pageLanguage: 'en', layout: google.translate.TranslateElement.InlineLayout.SIMPLE}, 'google_translate_element'); } </script><script type='text/javascript' src='//translate.google.com/translate_a/element.js?cb=googleTranslateElementInit'></script> </td> </tr> </tbody> </table> <table align='center' style=' background-color: #660000'> <tbody> <tr> <td align='left'> <img src= '' id='PersonImage' width='450' height='450'> </td> <td> <select name='Graphic_select' id='Graphic_select' onchange='changePic(this.value,personsnamejs);linkSound(this.value,personsnamejs);'> <option value ='default' id = 'def' style='height:120px;'></option> <?php $pname = "AdrianTudini"; $i=0; foreach(glob("/home/ecovibdc/public_html/ECOVIB2D/MYART/".$pname."/Graphicw/*w.bmp") as $files1){ $files1 = basename($files1); $priceofart = array("2","304","32","104","345","45","56","89","78","98","345","987", "56","67","89","765","765","34","532","76","98","987","765","321"); echo "<option value='{$files1}'.' '.'($'.'{$priceofart[$i]}'.')'>{$files1} ($ {$priceofart[$i]})</option>"; $i=$i+1; } ?> <script> var x = document.getElementById('Graphic_select').selectedIndex; document.getElementById('Graphic_select').value='{$files1}'; Priceofart = <?php $priceofart[x]; ?>; </script> </select> <img id='myImage' src=path height='450' width='450'> <p align='center' id='PlaySound' >Play the sound with my art in mind</p> <center><audio id='Sound' controls><source src=soundfilepath type='audio/mpeg'>You cannot play the sound in the browser.</audio></center> <br> <br> </td> </tr> </table> <center> <p id='Price'> </p></center> <center><form action="https://www.paypal.com/cgi-bin/webscr" method="post" starget="_top"> <p align='center' id='freename'>Enter Full Name:</p> <p align='center'><input id='Nameofperson' maxlength='50' name=username size='50' type='text' /></p> <p align='center' id='freeaddress'>Enter Email-Address:</p> <p align='center'><input id='e-address' maxlength='50' name=email size='50' type='text' /></p> <input type="hidden" name="cmd" value="_s-xclick"> <input type="hidden" name="hosted_button_id" value="NAHTXLUQDVU2Y"> <input type="image" src="https://www.paypalobjects.com/en_AU/i/btn/btn_buynowCC_LG.gif" border="0" name="submit" alt="PayPal – The safer, easier way to pay online!"> <img alt="" border="0" src="https://www.paypalobjects.com/en_AU/i/scr/pixel.gif" width="1" height="1"> </form></center> <p align='center' id='paypal'></p> <p align='center' class='style8'><a href='http://ecovib2d.blogspot.com.au'>Back to Ecovib2ds blog</a></p> <p align='center'><span class='style8'><a href='mailto:tudsy@ecovib2d.com.au'>Send me Mail</a></span></p> </body> </html> |
Christian J |
Jan 18 2017, 10:22 AM
Post
#2
|
. Group: WDG Moderators Posts: 9,656 Joined: 10-August 06 Member No.: 7 |
Are you having trouble with the javascript or the PHP?
In any case, please reformat the code example in a more readable way. Also remove irrelevant parts, such as the Google analytics script. |
pandy |
Jan 18 2017, 11:28 AM
Post
#3
|
🌟Computer says no🌟 Group: WDG Moderators Posts: 20,731 Joined: 9-August 06 Member No.: 6 |
And don't use BMP on the web. IE may load them (it used to, don't know how it is today), other browsers won't (or at least they didn't...).
You can use GIF, JPG and PNG. Depending of what kind of art it is, you should convert the images to JPG or PNG. JPG will be smaller, but you loose a little quality. It's good for photographs and similar images where the quality loss isn't noticeable. |
Christian J |
Jan 18 2017, 03:31 PM
Post
#4
|
. Group: WDG Moderators Posts: 9,656 Joined: 10-August 06 Member No.: 7 |
Actually BMP images seem to be well supported nowadays, but the file size usually becomes very large since they can't be compressed.
|
pandy |
Jan 18 2017, 04:32 PM
Post
#5
|
🌟Computer says no🌟 Group: WDG Moderators Posts: 20,731 Joined: 9-August 06 Member No.: 6 |
Really? What for?
|
Christian J |
Jan 18 2017, 04:53 PM
Post
#6
|
. Group: WDG Moderators Posts: 9,656 Joined: 10-August 06 Member No.: 7 |
No idea, according to https://w3techs.com/technologies/details/im-bmp/all/all BMP is only used by 0.3% of all websites, so it can't be for compatibility.
|
pandy |
Jan 18 2017, 05:02 PM
Post
#7
|
🌟Computer says no🌟 Group: WDG Moderators Posts: 20,731 Joined: 9-August 06 Member No.: 6 |
Interesting site. Is it trustworthy?
|
Christian J |
Jan 18 2017, 05:20 PM
Post
#8
|
. Group: WDG Moderators Posts: 9,656 Joined: 10-August 06 Member No.: 7 |
No idea, but it's quoted by e.g. https://www.w3.org/International/questions/...unicode.en.html
OTOH it lacks its own Wikipedia page, even though a few other wikipedia pages use it as a source: https://en.wikipedia.org/wiki/Special:Searc...rch=w3techs.com |
Lo-Fi Version | Time is now: 26th April 2024 - 09:16 AM |