PHP - Chrome Font Rendering / Smoothing Issue
The font is looking weird and not smooth as compared to Firefox:
Chrome screenshot: Firefox: This is my CSS: @font-face { font-family: 'Aldrich'; font-style: normal; font-weight: 400; src: local('Aldrich'), url(../font.woff) format('woff'); } body,input{ font-family: 'Aldrich', sans-serif; font-size:12px; }Any idea? Why is the font not smoothed out on Chrome (for font-weight:bold) properties? Similar TutorialsHi, I'm not sure where the problem is here. Right now this site works fine in IE and FF, but then I try to load data from the database into the cart, it get's screwed up in Chroms and Safari.
FF loads
<img src="inventory_images/11.jpg" alt="Some item" id="11" class="cartImages" border="1">While Chrome loads this <img src="inventory_images/url(http://localhost/Online/inventory_images/11.jpg).jpg" alt="" id="url(http://localhost/Online/inventory_images/11.jpg)" class="cartImages" border="1">From this if(isset($_POST['miniCartRequest'])){ include "/storescript/connect_to_mysql.php"; $cartOutput = ""; $cartTotal = ""; $product_name=""; $price=""; if(!isset($_SESSION['cart']) || count($_SESSION['cart'])<1){ $cartOutput = "<h2 align='center' style='color:white;'>Your cart is empty</h2>"; } else { $i = 0; foreach($_SESSION['cart'] as $each_item){ $item_id = $each_item['item_id']; $sql = $mysqli->query("SELECT * FROM products WHERE id='$item_id' LIMIT 1"); while($row = $sql->fetch_array()){ $product_name = $row['product_name']; $price = $row['price']; $details = $row['details']; $size = $row['size']; } $pricetotal = $price*$each_item['quantity']; $cartTotal = $pricetotal + $cartTotal; setLocale(LC_ALL, 'en_GB.utf8', 'en_GB'); $pricetotal = number_format($pricetotal, 2); $x = $i + 1; $cartOutput .= "<img src='inventory_images/" . $item_id . ".jpg' alt='" . $product_name . "' id='" . $item_id . "' class='cartImages' border='1' />"; $i++; } } echo $cartOutput; }Can I create an alternative line of code specificall for Chrome/safari to remove the excess characters? And why exactly are they reading the files with the full source locations vs firefox reading only the local location? It's completely unable to read the $product_name aswell. A bit strange, I take it those browsers process the specific information differently? Edited by 7blake, 05 January 2015 - 02:56 AM. I'm not sure if this is an HTML or browser issue... But single quotes in strings from database don't work for me in Chrome for some reason. To mine or any other computers. Every other browser detects these quotes. I'm outputting an SQL result containing strings like: Texas Hold'em or America's Cup and I get Texas Hold America Chrome is the browser I use, I have it set up so that the script detects safari and chrome as separate entities. When I browse to it, it shows: You are using Windows XP with a Chrome Web Browserwith a Safari Web Browser now I know stristr() is a case-insensitive version of strstr(), which will find the first form of a word in a string. The problem is that when I use it, the rest of the script doesn't work... it goes to the part as if nothing is there, and shows the text on the bottom. I can't figure out why. Can someone help me, is there a chrome/safari level of priority or am I just missing something? Code: [Select] <?php //Booleans to set OS and Browser to False. $os = false; $browser = false; //Booleans for Web Browser & OS Functions. $xp = xp(); $vista = vista(); $win7 = win7(); $ubuntu = ubuntu(); $chrome = chrome(); $safari = safari(); $firefox = firefox(); $ie9 = ie9(); $ie8 = ie8(); //Operating Systems function xp(){return(preg_match("/Windows NT 5.1/", $_SERVER['HTTP_USER_AGENT']));} function vista(){return(preg_match("/Windows NT 6.0/", $_SERVER['HTTP_USER_AGENT']));} function win7(){return(preg_match("/Windows NT 6.1/", $_SERVER['HTTP_USER_AGENT']));} function ubuntu(){return(preg_match("/Ubuntu/", $_SERVER['HTTP_USER_AGENT']));} //Web Browsers function chrome(){return(preg_match("/Chrome/", $_SERVER['HTTP_USER_AGENT']));} function safari(){return(preg_match("/Safari/", $_SERVER['HTTP_USER_AGENT']));} function firefox(){return(preg_match("/Firefox/", $_SERVER['HTTP_USER_AGENT']));} function ie9(){return(preg_match("/MSIE 9.0/", $_SERVER['HTTP_USER_AGENT']));} function ie8(){return(preg_match("/MSIE 8.0/", $_SERVER['HTTP_USER_AGENT']));} // If you have one of the valid Operating System. if($ubuntu){echo 'You are using Ubuntu Operating System ';} if($xp){echo 'You are using Windows XP ';} if($vista){echo 'You are using Windows Vista Operating System ';} if($win7){echo 'You are using Windows 7 Operating System ';} // If you have one of the valid Web Browser. if($chrome){echo 'with a Chrome Web Browser';} if($firefox){echo 'with an Firefox Web Browser';} if($safari){echo 'with a Safari Web Browser';} if($ie8){echo 'with an Internet Explorer 8 Web Browser';} if($ie9){echo 'with an Internet Explorer 9 Web Browser';} //If OS or Browser not found in list. if ($ubuntu || $xp || $vista || $win7) $os = true; if($firefox || $chrome || $safari || $ie9 || $ie8) $browser = true; if(!$browser || !$os){ echo'<strong>'; echo '<br />' . $_SERVER['HTTP_USER_AGENT'] . '<br /><br />Administrator someone in your work force is using an unsupported browser or OS, please email this information to the developer of the NCMR software you are using. It will allow your browser/OS combination to be used correctly. Sorry for the inconvenience.</strong> <br /><br />Please copy and paste the text above and send it to your web administrator. It will explain everything he/she needs to do.<br />';} ?> i am trying to find a way to render stl files into a jpg from a specific angle. any ideas? i have no clue. This topic has been moved to JavaScript Help. http://www.phpfreaks.com/forums/index.php?topic=352864.0 Hello,
I have a small bit of code that changes the background color of a table cell depending on the value. It works great if I call the script by itself as you can see from this link. http://www.mesquitew...lake-levels.php
But when I include it in on the page where I want to show it like so below, the background colors do not render color correctly as they as suppose to like from the link about, only the text color.
<?php include("inc/inc-lake-levels.php"); ?> It looks like this. I call it in a the table like so. <td style="color:<?php echo $LRH_departTxt; ?>" bgcolor="<?php echo $LRH_departScale; ?>"> <?php echo $LRH_calcDepart; ?></td>I am not sure if this is a PHP problem or a CSS issue but here is the bit of code that creates the colors based on the values. First part is the background color, second part is the text. $LRH_departScale = ''; if ($LRH_calcDepart <= 0 && $LRH_calcDepart > -2) { $LRH_departScale = 'rgb(82, 71, 59)'; } else if ($LRH_calcDepart <= -2 && $LRH_calcDepart > -4) { $LRH_departScale = 'rgb(192, 185, 67)'; } else if ($LRH_calcDepart <= -4 && $LRH_calcDepart > -6) { $LRH_departScale = 'rgb(192, 102, 67)'; } else if ($LRH_calcDepart <= -6 && $LRH_calcDepart > -8) { $LRH_departScale = 'rgb(185, 64, 76)'; } else if ($LRH_calcDepart <= -8 && $LRH_calcDepart > -10) { $LRH_departScale = 'rgb(170, 59, 145)'; } else if ($LRH_calcDepart <= -10) { $LRH_departScale = 'rgb(115, 58, 167)'; } $LRH_departTxt = ''; if ($LRH_calcDepart <= 0 && $LRH_calcDepart > -2) { $LRH_departTxt = 'rgb(186, 245, 171)'; } else if ($LRH_calcDepart <= -2 && $LRH_calcDepart > -4) { $LRH_departTxt = 'rgb(255, 220, 177)'; } else if ($LRH_calcDepart <= -4 && $LRH_calcDepart > -6) { $LRH_departTxt = 'rgb(255, 219, 177)'; } else if ($LRH_calcDepart <= -6 && $LRH_calcDepart > -8) { $LRH_departTxt = 'rgb(254, 177, 185)'; } else if ($LRH_calcDepart <= -8 && $LRH_calcDepart > -10) { $LRH_departTxt = 'rgb(245, 170, 228)'; } else if ($LRH_calcDepart <= -10) { $LRH_departTxt = 'rgb(208, 169, 243)'; }Other than the background colors not rendering correctly when included all else works fine. Is there something I am not doing correctly that is causing this? I am not even sure where the first place to start looking would be. -Thanks I have an array ($other_images) that contains image file names separated by semi colons. I can successfully echo the individual values using echo $other_images[0], $other_images[1], $other_images[2]... When I put it in a for loop, though, I run into the followng error: Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting ',' or ';' in... Here is my code: <?php $other_images = explode(";", $data['ItemAltImage']); for($i=0; $i<count($other_images); $i++) { echo "<p><img src='http:\\www.oppictures.com\SINGLEIMAGES\100\" . $other_images[$i] . "' /></p>"; } ?> This is the result of print_r($other_images): Array ( => UNV21200_3_2.JPG [1] => UNV21200_2_2.JPG [2] => UNV21200_4_1.JPG [3] => UNV21200_8_1.JPG [4] => UNV21200_5_1.JPG [5] => UNV21200_6_1.JPG [6] => UNV21200_7_1.JPG [7] => UNV21200_9_1.JPG ) Do you see where I'm making a mistake? Thanks Hello all, I'm new to PHP and to these forums and i'm having trouble with a little script I'm working on. I have to point out at the start that the script actually works, other than for the error I'm reporting. What it does, is lets the user upload an image to the server and creates a thumbnail imageof it in another folder. This works as intended. (I.e. the images gets uploaded and the thumbnail is created) The issue i'm having is when the work is completed successfully... If there's an error, I update a variable $msg with an error mesage. (File too large, or invalid filetype) If this is the case, the script will render the html code correctly, display the error, then redirect you using javascript after 4 seconds to the original page. No worries here, everything works so far. However, if there is no errors to report and the script is successfull, I update $msg to say "it worked"(or whatever) but instead of displaying the formatted webpage displaying the message, then redirecting after 4 seconds, all that happens is the html code is displayed instead. (If I cut and paste this code into a new htmlfile, it renders correctly.) Attached below is the php code which does all the work. (But not the main php file which calls it) Can someone please point me in the right direction as to what I'm doing wrong! lol (Again, I'm new here so a big hello from me!!!) Code: [Select] <?php print( "<html>\n"); print( " <head>\n"); print( " <title>Random banner and file upload</title>\n"); print( " <link rel=StyleSheet href=\"styles.css\" type=\"text/css\">\n"); print( " </head>\n"); print( " <body>\n" ); $file_upload = "true"; $filetype = $_FILES[ "file_up" ][ "type" ]; $file_name = $_FILES[ "file_up" ][ "name" ]; $startimage = $_FILES[ "file_up" ][ "tmp_name" ]; $largeimage = "images/uploads/$file_name"; $thumbimage = "images/uploadthumbs/thumb-$file_name"; $msg = " "; $invalidfilesize = "<p class='centeralign'>Your uploaded file size is more than 250KB so please reduce the file size and then upload.<br>Visit the help page to know how to reduce the file size.</p>\n"; $invalidfiletype = "<p class='centeralign'>Your uploaded file must be of PNG, JPG or GIF. Other file types are not allowed.</p>\n"; $successfullupload = "<p class='centeralign'>File uploaded successfully! :)</p>\n"; $failedupload = "<p class='centeralign'>File not uploaded successfully! :(</p>\n"; $notinstalled = "<p class='centeralign'>The requested function is not installed on this web server. :(</p>\n"; //If the image is larger than 1Mb, do not upload. if ( $_FILES[ "file_up" ][ "size" ] > 1048576 ) { $msg = $msg.$invalidfilesize; $file_upload="false"; } //If the image is an invalid file type, do not upload. if ( ! ( $filetype == "image/x-png" || $filetype == "image/pjpeg" || $filetype == "image/jpeg" || $filetype == "image/gif" ) ) { $msg = $msg.$invalidfiletype; $file_upload = "false"; } //Start the thumbnail generation. if( $file_upload == "true" ) { $n_width = 160; // Fix the width of the thumbnail images $n_height = 120; // Fix the height of the thumbnail imaage switch ( $filetype ) { case "image/x-png"; $FromFormat = "ImageCreateFromPNG"; $ToFormat = "ImagePNG"; break; case "image/jpeg"; $FromFormat = "ImageCreateFromJPEG"; $ToFormat = "ImageJPEG"; break; case "image/pjpeg"; $FromFormat = "ImageCreateFromJPEG"; $ToFormat = "ImageJPEG"; break; case "image/gif"; $FromFormat = "ImageCreateFromGIF"; $ToFormat = "ImageGIF"; break; } if ( function_exists( "$FromFormat" ) )// Generate the thumbnail. { $im = $FromFormat( $startimage ); $width = ImageSx( $im ); // Original picture width is stored $height = ImageSy( $im ); // Original picture height is stored $newimage = imagecreatetruecolor( $n_width, $n_height ); imageCopyResized( $newimage, $im, 0, 0, 0, 0, $n_width, $n_height, $width, $height ); Header( "Content-type: $filetype" ); $ToFormat( $newimage, $thumbimage ); } else { $msg = $msg.$notinstalled; }// Unable to generate the thumbnail. (GD library not installed on web server?) //Move the uploaded file to the correct place.. if( move_uploaded_file ( $startimage, $largeimage ) ) { $msg = $msg.$successfullupload; } else { $msg = $msg.$failedupload; }//Unable to move uploaded file. } Print( "$msg" ); print( " <script type=\"text/javascript\"><!--\n" ); print( " setTimeout('Redirect()',4000);\n" ); print( " function Redirect()\n" ); print( " {\n" ); print( " location.href = 'index.php';\n" ); print( " }// -->\n" ); print( " </script>\n" ); print( " </body>\n" ); print( "</html>\n" ); ?> Hi All, I have a form that enables the user to know events that occur in a specific city. Most of the time they get the results in a few seconds, despite the fact that many rows in various tables might be searched for detailed infos about the events in that city. However, this form partly relies on a table against which a MySQL event regularly does some operations. If the user uses the form while the event is being executed, they have to wait up to 30 seconds before getting the results, and sometimes only part of the html page is generated. Is there a way to avoid this lengthy waiting time ? I am wondering whether or not the best would be putting the site on maintenance while the event is being executed, with a "please come back in a few minutes" message. Thanks in advance for your help. Is there a Chrome tag like this IE one <!--[if IE]> <![endif]--> <!--[if !IE]><!--> <!--<![endif]--> I have use the above tag in my wordpress site, and the only browser it doesn't work in is Google Chrome. Hey everyone, I haven't been working with php long and that my be the root of the problem here but your help is very appreciated. Here is the problem: I have created a login system for a website everything seems to be working great in Chrome and FF. However IE8 is giving some problems. It acts as if my $username and $password variables don't get set. However, I have tried using echo and they print out just fine. I have tried rearranging my code and checking the variables with inset() ...nothing I try seems to work. Maybe I'm doing something wrong you guys can help with. Thanks. (Code below) Code: [Select] <?php session_start(); // Connect to database code here (left out for obvious reasons) ****** ****** //get user name and password before we try and connect $username = $_POST['username']; $password = $_POST['password']; //if username and password suck go back to login screen otherwise check against database. if(!$username && !$password) { header( 'refresh: 2; url=login.html' ); die("username and password could not be verified"); } else { ////here is where i would check database =p } ....... <?PHP include("include/session.php"); ?> <html> <head> <title></title> <style type="text/css"> .auto-style1 { text-align: center; } .auto-style2 { border: 2px solid #3366FF; } .auto-style3 { font-family: "Franklin Gothic Medium", "Arial Narrow", Arial, sans-serif; } </style> </head> <body style="background-color: #AAC6FF"> <?PHP if(isset($_SESSION['useredit'])){ unset($_SESSION['useredit']); echo "<h1><center>User Account Edit Success!</center></h1>"; echo "<p><b><center>$session->username</b>, your account has been successfully updated. " ."<a href=\"javascript:window.close();\">Close Window</a>.</p></center>"; }else{ ?> <?PHP if($session->logged_in){ ?> <h1 class="auto-style1"><span class="auto-style3">User Account Edit :</span> <? echo $session->username; ?></h1> <?PHP if($form->num_errors > 0){ echo "<td><font size=\"2\" color=\"#ff0000\">".$form->num_errors." error(s) found</font></td>"; } ?> <form action="process.php" method="POST"> <div align="center"> <table class="auto-style2" style="width: 300px"> <tr> <td>Current Password:</td> <td> <input name="curpass" style="width: 150px" type="password" value="<? echo $form->value("curpass"); ?>"></td> <td><? echo $form->error("curpass"); ?></td> </tr> <tr> <td>New Password:</td> <td> <input name="newpass" style="width: 150px" type="password" value="<? echo $form->value("newpass"); ?>"></td> <td><? echo $form->error("newpass"); ?></td> </tr> <tr> <td>Current Email:</td> <td><input name="email" style="width: 150px" type="text" value="<? if($form->value("email") == ""){ echo $session->userinfo['email']; }else{ echo $form->value("email"); } ?>"></td> <td><? echo $form->error("email"); ?></td> </tr> <tr> <td> </td> <td> <form method="post"> <input type="hidden" name="subedit" value="1"> <input name="submit" type="submit" value="submit"></form> </td> </tr> </table> </div> </form> <?PHP } } ?> </body> </html> Hey guys, i've made a script to display a random image. Works perfect on firefox, ie but not chrome =/. Rotate.php <?php // rotate images randomly but w/o dups on same page - format: // <img src='rotate.php?i=0'> - rotate image #0 - use 'i=1' // for second, etc // (c) 2004 David Pankhurst - use freely, but please leave in my credit $images=array( // list of files to rotate - add as needed "images/1.jpg", "images/2.jpg", "images/3.jpg", "images/4.jpg", "images/5.jpg", "images/6.jpg", "images/7.jpg", "images/8.jpg", "images/9.jpg" ); $total=count($images); $secondsFixed=2; // seconds to keep list the same $seedValue=(int)(time()/$secondsFixed); srand($seedValue); for ($i=0;$i<$total;++$i) // shuffle list 'randomly' { $r=rand(0,$total-1); $temp =$images[$i]; $images[$i]=$images[$r]; $images[$r]=$temp; } $index=(int)($_GET['i']); // image index passed in $i=$index%$total; // make sure index always in bounds $file=$images[$i]; header ("Location: $file"); header ("Content-Length: 0"); exit; ?> and then to call it, script.php <img src='rotate.php?i=0' width="90%" height="90%" alt="" /> Not sure where in the forum to put this one. Has any noticed when you use pagination with Chrome 18, it tries to display a link to the next page and display what it thinks is the next page? It really shows the last page and is confusing to viewers. Is it possible to have Chrome ignore pages? Yesterday I had this problem - I created this website in wordpress www.porthopehealthcentre.com It displayed correct in firefox but not ie. There was an extra closing </div> tag in my header php. When I deleted it, it displayed correct in ie but not firefox. So I added the below tag to my header.php file. It now displays correct in all browsers except google chrome, latest version. What can I do to fix this so it displays correct in google chrome - anybody? Thanks in advance - I really appreciate it. <!--[if IE]> <![endif]--> <!--[if !IE]><!--> </div> <!--<![endif]--> two questions, 1) what is the default font that is used? 2) if i wanted to change the font for the whole site, is that simple? I've been trying to create a [font] bb code for my site which would allow the attributes color, size and face, but and can't really think of any way it would work. Most of my regex is guesswork so I'm struggling with this a bit. The tag wouldn't strictly need any attributes and could be in any particular order, so it would be a lot like the html <font> tag. If anyone could point me in the right direction I'd appreciate it. here's what I have so far: $string = preg_replace('/\[font([\sface|\ssize|\scolor\]=](.+?)(\]|\s)+)/i','',$string); The bit where I've stumbled is the second parameter. I'm not really where I'd go from there. Anyway, if you can help me, cheers! I've been googling with very little sucsse to find out if and how I can define a certain font to be used in the message body wtih out the viewer having to have the font installed on there computer. Is this at all possible? This topic has been moved to CSS Help. http://www.phpfreaks.com/forums/index.php?topic=357315.0 |