everettcomstock Posted December 29, 2006 Share Posted December 29, 2006 Hi Everyone, Sorry to bother you all, but I have a problem that is just driving me nuts. I am a novice PHP programmer, and I have programmed two different sites to display an album cover. The first site is www.otteradio.com. This site shows the currently playing album cover and song name. I have a personal website (www.everettcomstock.com) that shows the same album cover and song name. The otterradio.com site always displays the cover picture correctly, but my personal site will not show pictures if the title includes and apostrophe. I am not using a database like MySQL, and the links are all Raw URL Encoded. I am going to post a little bit of my script in hopes that it will help any of you who are interested in this problem.I use a separate file to actually display the image and image header (image.php)I call it from a URL embedded in am IMG tag: <?php$path = $_GET[path];$image = imagecreatefromjpeg("$path\folder.jpg");header("Content-Type: image/jpeg");imagejpeg($image);?>I have a separate file where I gather current song information (getsonginfo.php) to create the link for the URL used to call image.php:<?php $info = file("D:\Webroot\everett\otterradio\history\songhistory.html"); $Artist = array("$info[0]", "$info[4]", "$info[8]", "$info[12]", "$info[16]", "$info[20]", "$info[24]", "$info[28]", "$info[32]", "$info[36]"); $Song = array("$info[1]", "$info[5]", "$info[9]", "$info[13]", "$info[17]", "$info[21]", "$info[25]", "$info[29]", "$info[33]", "$info[37]"); $Album = array("$info[2]", "$info[6]", "$info[10]", "$info[14]", "$info[18]", "$info[22]", "$info[26]", "$info[30]", "$info[34]", "$info[38]"); $File = array("$info[3]", "$info[7]", "$info[11]", "$info[15]", "$info[19]", "$info[23]", "$info[27]", "$info[31]", "$info[35]", "$info[39]"); $y=0; While ($y != '10'){ $filepath = pathinfo($File[$y]); //File Path $dirpath = $filepath[dirname]; //Convert to Directory Path $rawencode = rawurlencode($dirpath); //Raw Encode the path to HTTP URL $Path[$y] = $rawencode; //Store Path Variable $y++; } $x=0; While ($x != '10'){ if ($x=="0"){ $imagepath = "<img class='npcover' src='http://otterradio.com/songinfo/image.php?path=$Path[$x]'>"; } else { $imagepath = "<img class='cover' src='http://otterradio.com/songinfo/image.php?path=$Path[$x]'>"; } $Image[$x] = $imagepath; $x++; }?> And finally, I include the getsonginfo.php file on both pages and place the $Image[0] variable where I want the cover art to be displayed. Again, for some reason, it works great at otterradio.com, but at everettcomstock.com, the art does not display when the artist name or song title has an apostrophe in it. Sorry for posting so much code. Thanks for all of the help. And, if you have any suggestions outside of my question, I would love to hear them.Everett Link to comment https://forums.phpfreaks.com/topic/32156-url-encoding-driving-me-crazy/ Share on other sites More sharing options...
everettcomstock Posted December 30, 2006 Author Share Posted December 30, 2006 Hi Evereyone, I also just noticed, that my scripts actually work in Firefox. It seems to be IE 6.0 (and possibly other versions) where I experience the problem. If this triggers any ideas, pleaselet me know! Thanks!Everett Link to comment https://forums.phpfreaks.com/topic/32156-url-encoding-driving-me-crazy/#findComment-149594 Share on other sites More sharing options...
trq Posted December 30, 2006 Share Posted December 30, 2006 If it works in some browsers and not in other than your issue is with your html not php. PHP is well and truely finished before anything is sent to the browser.View your html source for errors. Run your page through the w3c validator. This should find your issues. Link to comment https://forums.phpfreaks.com/topic/32156-url-encoding-driving-me-crazy/#findComment-149602 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.