PHP - How Do I Add The Width And Height To An Iframe In My Code.
Hi People.
Thanks for all the help on here in the past, you have been brilliant. I run the airfield cards.com website and have a script in the output page that is as follows. Code: [Select] To Embed this Card into your website, cut and paste the following code: <input name="generate" value="<? echo "<iframe src='http://www.airfieldcards.com/php/courtesy_card.php?id=".$id. "' ></iframe>";?>"> Now the way it shows on the site is like this Code: [Select] <iframe src='http://www.airfieldcards.com/php/courtesy_card.php?id=165' ></iframe> So, I look at the iframe code from google that should be cut and pasted into a website (obviously it's working code from google) Code: [Select] <iframe width="700" height="1500" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="http://maps.google.co.uk/maps/ms?msa=0&msid=203054009368331462137.0004aa731e7de2e86a0e0&ie=UTF8&t=h&vpsrc=0&ll=53.800651,-4.042969&spn=80.03397,61.435547&z=4&output=embed"></iframe><br /><small>View <a href="http://maps.google.co.uk/maps/ms?msa=0&msid=203054009368331462137.0004aa731e7de2e86a0e0&ie=UTF8&t=h&vpsrc=0&ll=53.800651,-4.042969&spn=80.03397,61.435547&z=4&source=embed" style="color:#0000FF;text-align:left">AirfieldCards.com</a> in a larger map</small> Now I have tried to take the code from the google iframe (width/height/scrolling/etc) and paste it into my source but it doesn't work. Here's how I have done it. Code: [Select] To Embed this Card into your website, cut and paste the following code: <input name="generate" value="<? echo "<iframe width="700" height="1500" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src='http://www.airfieldcards.com/php/courtesy_card.php?id=".$id. "' ></iframe>";?>"> Can someone please modify my fist lot of code so that I have the correct height and width settings (700 x 1500) Thanks in advance Regards Vince Gledhill Similar TutorialsHi there. How can i set up a maximum width and height of a picture? For example: the limit is 400x400. So if the photo is 200x200 then it stays that way, however if a photo is 550x550 then it gets resized to 400x400. i am uploading image to s3 server and by php i am making a copy of that image on server , if i upload an image of 2.3 mb than the width of image is not coming but if i upload less size image like 26kb than it is showing the width of image so it is able to create the copy . here is my code of php : $s3 = new S3(awsAccessKey, awsSecretKey); $thumbId = uniqid(); $thumbId .= ".jpg"; $img = ''; if($imgType == "image/jpeg"){ $img = imagecreatefromjpeg($sourceUrl); }else if($imgType == "image/png"){ $img = imagecreatefrompng($sourceUrl); }else if($imgType == "image/gif"){ $img = imagecreatefromgif($sourceUrl); }else{ $img = imagejpeg($sourceUrl); } echo $width = imagesx( $img ); echo $height = imagesy( $img ); please tell me what is the problem with size of image.. regards rahul Hi Fellas, having a bit of a brain freeze here, i am trying to set a max width or height for a uploaded image, but my brain has frozen, maybe its the cold weather lol list($width,$height)=getimagesize($uploadedfile); $newwidth=250; $newheight=($height/$width)*$newwidth; $tmp=imagecreatetruecolor($newwidth,$newheight); basicly i want to find the biggest size of an image, beit width or height then set that size to 250... Any pointers here? how do i set the scrolll width of the page in the iframe, so i can scroll horizontally in the iframe? Code: [Select] <Iframe src="test.php?search=<?php echo $search; ?>" width="900px" height="600px"></Iframe> this sets the iframe perimeter size, but i want the inner size to be much bigger. maybe a better question is how to increase page size of test.php Hi folks, I'm using this code to display a picture that is uploaded in a form. Code: [Select] print "<img src='http://www.coast2kosci.com/mylongrun/test/photo_uploads/$imgx' width='300' height='300' alt='Your photo' />"; At first I tried specifying only the width, without the height. But for tall photos, the display wasn't really what I was after. Then I specified both width and height, which results in a mis-scaled photo. Is there any way that I can specify the height and width atributes as a sort of maximum / or limiter. Ie: If the height is greater than the width, limit the height to 300, and if the width is greater than the height, limit the width to 300? Thanks for your time, Dave Hey guys! I have the following php code that grabs variables (and the browsed image) from Flash. //FLASH VARIABLES $Name = $_POST['Name']; $itemNumber = $_POST['itemNumber']; $filename = $_FILES['Filedata']['name']; $filetmpname = $_FILES['Filedata']['tmp_name']; $fileType = $_FILES["Filedata"]["type"]; $fileSizeMB = ($_FILES["Filedata"]["size"] / 1024 / 1000); list($filename, $extension) = explode('.', basename($_FILES['Filedata']['name'])); $filename = $Name; $target = $filename . $itemNumber . "." . $extension; // Place file on server, into the images folder move_uploaded_file($_FILES['Filedata']['tmp_name'], "images/".$target); This works perfect, but what I want to change is the width and height of the uploaded image. Any ideas/suggestions on how this could be done? Thanks in advance!! Cheers! Hi Im working on a market place style website. the framework im using is called elgg. it uses an algoritm to find the right approximate width and height of an image thats being uploaded. but on my site, all heights and widths must be the same. this is difficult because some pictures have much greater width than height and some have much greater height. so whats the best algoritm to use to make an accurate thumbnail of all images uploaded? Thanks Hey guys I have a small issue, i have an upload that resizes the image into thumbnail by max width and ratios the width based on that. Here is my code
What I am wanting to do is instead upload the image with a max height and ratio the width proportionally. What variables do I have to reverse? Okay, so here is the deal. Have a table which stores image as blob files. Now i want to read the image width and height directly from the blob field. Is this possible and if yes, how? Things i tried so far; list($size[0],$size[1],$type, $attr) = getimagesize('image.php?i=26ddd45b02859e836d13d4b9fde34281'); print_r($size); $img = 'image.php?i=26ddd45b02859e836d13d4b9fde34281'; echo imagesy($img); image.php grabs the image from DB and show's it with header("Content-type: image/jpg"); It works for just showing the images with the <img> tag. Any ideas of help would be great! I have folder with 100's images, how to find Height and width as Excel sheet? This happens from time to time and it really drives me crazy. I cannot get the problem to reproduce, although I have plenty of evidence that it is happening. I have a php page that pulls in some database from mssql formats it in a nice table then send via email to a 3rd party. All of that works great. What happens is in some of the emails the first column will show the table cell information for the next column. See example: Code: [Select] Mascaw Mar. 8, 2012 - 6:15 pm Ronnie Johnson Newtown Pike<td width="150"> Mar. 8, 2012 - 6:15 pm Todd Doe Hall of Justice Mar. 8, 2012 - 6:15 pm Carol French I had this problem before with another emailing system and found that wrapping the email to 900 before sending it out fixed it. I wrapped this with $message = wordwrap($message, 900, "\n", true);() but it doesn't seem to make a difference. Anyone ran into this before? Any help would be greatly appreciated! Thanks Hi, I have a page where users can add some text and additionally images. This is done through a textbox and NicEditor. Users are able to add images with any size, by either uploading it or usea URL. The problem occurs when they add a image wider than 560px, because then it ruins my lay out. This is why i want to add style="max-width:560px;" at the end of all image tags. So for example Code: [Select] <img src="http://images.com/image.jpg" style="max-width:560px;"> If made the following code but this only works when a user adds just one image, i need it to work also when there are multiple images. Code: [Select] <?php $img = '<img src="http://images.com/image.jpg">'; $imgstart = strpos($img,'<img'); // get position of <img if($imgpstart !== false) { $imgend = strpos($img,'>'); // get position of > $width = ' style="max-width:560px;">'; $img= substr_replace($img, $width, $imgend, 1); // replace > with $width } echo $img; ?> This may not be the safest and best solution so i'd like some help with a function which finds all images in a string and give them a max-width. thanks! Hi, I have some code which displays my blog post in a foreach loop, and I want to add some social sharing code(FB like button, share on Twitter etc.), but the problem is the way I have my code now, creates 3 instances of the sharing buttons, but if you like one post, all three are liked and any thing you do affects all of the blog post. How can I fix this? <?php include ("includes/includes.php"); $blogPosts = GetBlogPosts(); foreach ($blogPosts as $post) { echo "<div class='post'>"; echo "<h2>" . $post->title . "</h2>"; echo "<p class='postnote'>" . $post->post . "</p"; echo "<span class='footer'>Posted By: " . $post->author . "</span>"; echo "<span class='footer'>Posted On: " . $post->datePosted . "</span>"; echo "<span class='footer'>Tags: " . $post->tags . "</span>"; echo ' <div class="addthis_toolbox addthis_default_style "> <a class="addthis_button_facebook_like" fb:like:layout="button_count"></a> <a class="addthis_button_tweet"></a> <a class="addthis_counter addthis_pill_style"></a> </div> <script type="text/javascript">var addthis_config = {"data_track_clickback":true};</script> <script type="text/javascript" src="http://s7.addthis.com/js/250/addthis_widget.js#username=webguync"></script>'; echo "</div>"; } ?> I have the following code in html: <html> <head> <script type="text/javascript"> <!-- function delayer(){ window.location = "http://VARIABLEVALUE.mysite.com" } //--> </script> <title>Redirecting ...</title> </head> <body onLoad="setTimeout('delayer()', 1000)"> <script type="text/javascript"> var sc_project=71304545; var sc_invisible=1; var sc_security="9c433fretre"; </script> <script type="text/javascript" src="http://www.statcounter.com/counter/counter.js"></script><noscript> <div class="statcounter"><a title="vBulletin statistics" href="http://statcounter.com/vbulletin/" target="_blank"><img class="statcounter" src="http://c.statcounter.com/71304545/0/9c433fretre/1/" alt="vBulletin statistics" ></a></div></noscript> </body> </html> Is a basic html webpage with a timer redirect script and a stascounter code. I know a bit about html and javascript, but almost nothing about php. My question is: How a can convert this html code into a php file, in order to send a variable value using GET Method and display this variable value inside the javascript code where says VARIABLEVALUE. Thanks in adavance for your help. hey gurus, i am a newbie php coder.. i am learning by example. what i am trying to do is write a piece of code which will alter 3 tables (user, bonus_credit, bonus_credit_usage) ---------------------------------------------------------------- the table structure that will be used is as follows: user.bonus_credit user.ID bonus_credit.bonusCode bonus_credit.qty bonus_credit.value bonus_credit_usage.bonusCode bonus_credit_usage.usedBy ---------------------------------------------------------------- so lets say, in bonus_credit i have the following bonusCode = 'facebook' (this is the code they have to type to redeem the bonus qty = '10' ( number of times the bonusCode can be redeemed, but same person can't redeem it more than once) value = '5' (this is the amount of bonus_credit for each qty) Now, I need to write a code that check to see if the code has been redeemed in the bonus_credit_usage table and if the user.ID exists in this table as bonus_code_usage.usedBy, then give an error that its already been used and if it hasn't been used, then subtract 1 from qty, add ID to usedBy and then add the value to the bonus_credit ----------------------- i have started the steps just to create a simple textbox and entering a numeric value to bonus_credit, and that works.. but now i have to use JOIN and IF and ELSE.. which is a little too advanced for me.. so i'd appreciate a guide as i write the code. if(isset($_REQUEST['btnBonus'])) { $bonus_credit = addslashes($_REQUEST['bonusCode']); $query = "update user set bonus_credit=bonus_credit+'".$bonus_credit."' where id='".$_SESSION['SESS_USERID']."'"; echo "<script>window.location='myreferrals.php?msgs=2';</script>"; mysql_query($query) or die(mysql_error()); } Advance thank you. Can you help please. The error..... Warning: mysql_fetch_assoc() expects parameter 1 to be resource, string given in C:\wamp\www\test_dabase.php on line 24 code. Code: [Select] <?php //database connection. $DB = mysql_connect("localhost","root") or die(mysql_error()); if($DB){ //database name. $DB_NAME="mysql"; //select database and name. $CON=mysql_select_db($DB_NAME,$DB)or die(mysql_error()."\nPlease change database name"); // if connection. }if($CON){ //show tables. $mysql_show="SHOW TABLES"; //select show and show. $mysql_select2="mysql_query(".$mysql_show.") or die(mysql_error())"; } //if allowed to show. if($mysql_select2){ //while it and while($data=mysql_fetch_assoc($mysql_select2)){ //show it. echo $data; } } ?> Hi, I need to insert some code into my current form code which will check to see if a username exist and if so will display an echo message. If it does not exist will post the form (assuming everything else is filled in correctly). I have tried some code in a few places but it doesn't work correctly as I get the username message exist no matter what. I think I am inserting the code into the wrong area, so need assistance as to how to incorporate the username check code. $sql="select * from Profile where username = '$username'; $result = mysql_query( $sql, $conn ) or die( "ERR: SQL 1" ); if(mysql_num_rows($result)!=0) { process form } else { echo "That username already exist!"; } the current code of the form <?PHP //session_start(); require_once "formvalidator.php"; $show_form=true; if (!isset($_POST['Submit'])) { $human_number1 = rand(1, 12); $human_number2 = rand(1, 38); $human_answer = $human_number1 + $human_number2; $_SESSION['check_answer'] = $human_answer; } if(isset($_POST['Submit'])) { if (!isset($_SESSION['check_answer'])) { echo "<p>Error: Answer session not set</p>"; } if($_POST['math'] != $_SESSION['check_answer']) { echo "<p>You did not pass the human check.</p>"; exit(); } $validator = new FormValidator(); $validator->addValidation("FirstName","req","Please fill in FirstName"); $validator->addValidation("LastName","req","Please fill in LastName"); $validator->addValidation("UserName","req","Please fill in UserName"); $validator->addValidation("Password","req","Please fill in a Password"); $validator->addValidation("Password2","req","Please re-enter your password"); $validator->addValidation("Password2","eqelmnt=Password","Your passwords do not match!"); $validator->addValidation("email","email","The input for Email should be a valid email value"); $validator->addValidation("email","req","Please fill in Email"); $validator->addValidation("Zip","req","Please fill in your Zip Code"); $validator->addValidation("Security","req","Please fill in your Security Question"); $validator->addValidation("Security2","req","Please fill in your Security Answer"); if($validator->ValidateForm()) { $con = mysql_connect("localhost","uname","pw") or die('Could not connect: ' . mysql_error()); mysql_select_db("beatthis_beatthis") or die(mysql_error()); $FirstName=mysql_real_escape_string($_POST['FirstName']); //This value has to be the same as in the HTML form file $LastName=mysql_real_escape_string($_POST['LastName']); //This value has to be the same as in the HTML form file $UserName=mysql_real_escape_string($_POST['UserName']); //This value has to be the same as in the HTML form file $Password= md5($_POST['Password']); //This value has to be the same as in the HTML form file $Password2= md5($_POST['Password2']); //This value has to be the same as in the HTML form file $email=mysql_real_escape_string($_POST['email']); //This value has to be the same as in the HTML form file $Zip=mysql_real_escape_string($_POST['Zip']); //This value has to be the same as in the HTML form file $Birthday=mysql_real_escape_string($_POST['Birthday']); //This value has to be the same as in the HTML form file $Security=mysql_real_escape_string($_POST['Security']); //This value has to be the same as in the HTML form file $Security2=mysql_real_escape_string($_POST['Security2']); //This value has to be the same as in the HTML form file $sql="INSERT INTO Profile (`FirstName`,`LastName`,`Username`,`Password`,`Password2`,`email`,`Zip`,`Birthday`,`Security`,`Security2`) VALUES ('$FirstName','$LastName','$UserName','$Password','$Password2','$email','$Zip','$Birthday','$Security','$Security2')"; //echo $sql; if (!mysql_query($sql,$con)) { die('Error: ' . mysql_error()); } else{ mail('email@gmail.com','A profile has been submitted!',$FirstName.' has submitted their profile',$body); echo "<h3>Your profile information has been submitted successfully.</h3>"; } mysql_close($con); $show_form=false; } else { echo "<h3 class='ErrorTitle'>Validation Errors:</h3>"; $error_hash = $validator->GetErrors(); foreach($error_hash as $inpname => $inp_err) { echo "<p class='errors'>$inpname : $inp_err</p>\n"; } } } if(true == $show_form) { ?> Hello I need help with a width issue I made a addnews page and it all works great but on my main page the widths limits are pretty short 200px and everytime i post something it exceeds that and screws up the website can you help where do I add the limits? on the front page coding? <? include("*****.inc"); $getnews = mysql_query("select * from news ORDER BY id DESC LIMIT 1 "); while($r=mysql_fetch_array($getnews)){ extract($r); echo("<p><b><i>$title <br/> $date</p></b></i>$news<br><br><br><br>"); } ?> The addnews? Code: [Select] <form action="submit.php" method="post"> <b>Title</b> <BR /> <input type="text" name="title" size="40" maxlength="80" value="Enter Title Here" /> <br /> <br /> <b>News</b><BR><textarea rows="5" cols="40" name="news" id="news" onKeyDown="textCounter(this,'progressbar1',150)" onKeyUp="textCounter(this,'progressbar1',150)" onFocus="textCounter(this,'progressbar1',150)"></textarea><br /> <div id="progressbar1" class="progress"></div> <script>textCounter(document.getElementById("maxcharfield"),"progressbar1",150)</script> <br /> <br /> <input type="submit" value="Submit" /> <input type="reset" value="Reset" /> </form> or in the submitt file <? //grabs the variables $news = $_POST["news"]; $title = $_POST["title"]; //gets mysql info include("******.inc"); //gets the current date... $date = date("m/d/Y h:i A"); $addnews =MYSQL_QUERY("INSERT INTO news (id,title,date,news)". "VALUES ('NULL', '$title', '$date', '$news')"); //success... echo(""); ?> Thank for the help is there a way to get the $image width?... the $image is not on my server so i cant use getimagesize().. e.g. $image = http://www.example.com/picture.jpg how do i get the width? Hi, ok so i have just created a form in HTML and am having the following problem in CSS
This is what the form looks like: http://gyazo.com/0aa...0dcf8f30efe4f9d
Now you can see that the width is covering the page each side
How can i fix this? for both width and height?
Here is my code:
#form { background-color: #111; margin: 0; text-align: center; padding: 15px; width: auto; height: auto; color: yellow; } #form input { border: 2px solid #ff0000; color: #ff0000; } |