twilitegxa
-
Posts
1,020 -
Joined
-
Last visited
Posts posted by twilitegxa
-
-
Is it possible to use php to set the size of a window, say for example when opening a SWF file, so that it won't be as large as the entire normal-sized browser window? Or would that be another programming language, such as Javascript? Not sure where to ask this. Can anyone help?
-
Okay, thanks very much for the help!
-
Yes, I have access to the content before it is output. The code I will be using will go into a template that is used for all posts. Can you explain how I would do it please?
-
I'm trying to write a code that will basically say:
If an image is present (<img src="image.jpg" />), leave formatting as is. But id there is no image present, display a 25px top margin. Is there a way to do this?
It's actually for a Wordpress site I'm working on, and the posts section has the right formatting I want when I place an image at the beginning of the post, but if no image is posted, the spacing is screwed up. Can anyone help?
-
Thank you soooooooo much! I was pulling out my hair wondering what i did wrong!!!! Thank you very much!
-
I am having an issue displaying my images that I have uploaded to my server. I have just changed the way in which the files are uploaded to my server (which now includes uploading two files on one form instead of just one), but I can't imagine how that would affect the way in which I display the images, because they are being saved into the same folder on my server, and I have double checked and the images are actually saving in the folder, as well as the path to the images are saving to the database (everything looks like it is right anyway). So, my problem somehow lies in how I am trying to display the images I guess. Here is a link to the page to view for an example:
http://midwestcreativeconsulting.com/jhrevell/collections/
If you click on one of the images, the first one (which you can actually see) is apparently working, while the second one you cannot see, but it appears to have saved correctly.
Here is my script for displaying the images:
<div class="contentleft"> <div class="toptitle">Collections<> <div class="topsubtitle"> <h3 class="padding">Click on an image to view details about the piece of jewelry:</h3> <?php $dbhost = 'localhost'; $dbuser = 'username'; $dbpass = 'password'; $conn = mysql_connect($dbhost, $dbuser, $dbpass) or die ('Error connecting to mysql'); $dbname = 'database'; mysql_select_db($dbname); $all_records = "SELECT * FROM gallery"; $all_records_res = mysql_query($all_records); $num_rows = mysql_num_rows($all_records_res); echo "<div id='extra-padding'>"; if ($num_rows == '0') { echo "<p class='empty'>No jewelry exists. Please <a href='http://midwestcreativeconsulting.com/jhrevell/add'>add</a> some.</p>"; } else { while($image=mysql_fetch_array($all_records_res)){ echo "<div class='padding'><a href='http://midwestcreativeconsulting.com/jhrevell/view/?id=" .$image['id']. "'><img src='http://midwestcreativeconsulting.com/jhrevell/wp-content/themes/twentyten_3/upload/" .$image['image']. "' width='133' height='86' /><></a>"; } } echo "<>"; ?> <> <>
So, it works for the first image, why not the second one? I can't understand what I am doing differently. Can anyone please help?
-
Okay, I don't know why, but before it wasn't working at all, but now all of a sudden the images are uploading the server, and I haven't changed anything. I am having another problem though, with displaying those images, but I will post another topic for that one. Not sure how this resolved itself though...
-
I'm trying to upload two image files to my server on one form. I found a tutorial that is supposed to do this, but it's not working for some reason. I have the file upload form here:
(excerpt of just the code where the file uploads are)
<tr> <td>Angle 1:</td> <td><input name="ufile[]" type="file" id="ufile[]" /></td> </tr> <tr> <td>Angle 2:</td> <td><input name="ufile[]" type="file" id="ufile[]" /></td> </tr>
And here is the code that is supposed to copy the files to my directory on my server as well as insert the record into the database:
//set where you want to store files //in this example we keep file in folder upload //$HTTP_POST_FILES['ufile']['name']; = upload file name //for example upload file name cartoon.gif . $path will be upload/cartoon.gif $path1= "upload/".$HTTP_POST_FILES['ufile']['name'][0]; $path2= "upload/".$HTTP_POST_FILES['ufile']['name'][1]; //$path3= "upload/".$HTTP_POST_FILES['ufile']['name'][2]; //copy file to where you want to store file copy($HTTP_POST_FILES['ufile']['tmp_name'][0], $path1); copy($HTTP_POST_FILES['ufile']['tmp_name'][1], $path2); //copy($HTTP_POST_FILES['ufile']['tmp_name'][2], $path3); //$HTTP_POST_FILES['ufile']['name'] = file name //$HTTP_POST_FILES['ufile']['size'] = file size //$HTTP_POST_FILES['ufile']['type'] = type of file echo "File Name :".$HTTP_POST_FILES['ufile']['name'][0]."<BR/>"; echo "File Size :".$HTTP_POST_FILES['ufile']['size'][0]."<BR/>"; echo "File Type :".$HTTP_POST_FILES['ufile']['type'][0]."<BR/>"; echo "<img src=\"$path1\" width=\"150\" height=\"150\">"; echo "<P>"; echo "File Name :".$HTTP_POST_FILES['ufile']['name'][1]."<BR/>"; echo "File Size :".$HTTP_POST_FILES['ufile']['size'][1]."<BR/>"; echo "File Type :".$HTTP_POST_FILES['ufile']['type'][1]."<BR/>"; echo "<img src=\"$path2\" width=\"150\" height=\"150\">"; echo "<P>"; //echo "File Name :".$HTTP_POST_FILES['ufile']['name'][2]."<BR/>"; //echo "File Size :".$HTTP_POST_FILES['ufile']['size'][2]."<BR/>"; //echo "File Type :".$HTTP_POST_FILES['ufile']['type'][2]."<BR/>"; //echo "<img src=\"$path3\" width=\"150\" height=\"150\">"; /////////////////////////////////////////////////////// // Use this code to display the error or success. $filesize1=$HTTP_POST_FILES['ufile']['size'][0]; $filesize2=$HTTP_POST_FILES['ufile']['size'][1]; //$filesize3=$HTTP_POST_FILES['ufile']['size'][2]; if($filesize1 && $filesize2 != 0) { echo "We have recieved your files"; } else { echo "ERROR....."; } ////////////////////////////////////////////// // What files that have a problem? (if found) if($filesize1==0) { echo "There're something error in your first file"; echo "<BR />"; } if($filesize2==0) { echo "There're something error in your second file"; echo "<BR />"; } //if($filesize3==0) { //echo "There're something error in your third file"; //echo "<BR />"; //} //end new code here $query = "INSERT INTO gallery VALUES ('', '$cut', '$color', '$carats', '$clarity', '$size', '$metal', '$other', '$total', '$certificate', '$value', '$path1', '$name', '$desc', '$item_no', '$type', '$path2')"; $query_res = mysql_query($query) or die(mysql_error());
The insert statement is working perfectly, but I need to know what is causing my file uploads to not work. I was using a previous code but it only worked to upload one image, and I'd like to offer two image uploads on one form. Can anyone please help me out here? Why could this not be working?
-
kenrbnsn,
Thank you so much for your help! I am terrible at not setting up error checking. I will try to remember to start using it more often. Your suggestion worked perfectly! Thank you again sooo much!!!!
-
What is not working is when I try to type something else into the textarea to save it, it is not updating in the database. Sorry if I miscommunicated that.
And thank you for reminding me about the validation. I'm going to have to work on that next ;-)
By the way, everything else is being updated in the database, the only one that doesn't work in the desc one. Not sure exactly why except for what I already stated.
-
So, just for clarification, if the file is on a server, how would an absolute path look then if you can't use http protocol? How can you say C:/? How could you know? Is it just best to use the relative path in this case maybe?
By the way, the relative path did work for me, so thank you everyone!!!
-
I'm trying to make an editable form that populates with the fields from a database, but my textarea field isn't working properly. To display the data from the textarea's field, I'm using the following syntax:
while($image=mysql_fetch_array($all_records_res)){ $id = $image['id']; $cut = $image['cut']; $color = $image['color']; $carats = $image['carats']; $clarity = $image['clarity']; $size = $image['size']; $type = $image['type']; $other = $image['other']; $total = $image['total']; $certificate = $image['certificate']; $value = $image['value']; $name = $image['name']; $desc = $image['desc']; $item_no = $image['item_no']; $metal = $image['metal']; $angle1 = $image['image']; $angle2 = $image['image2']; echo "<tr> <td>Item Number:</td> <td><input type='text' id='item_no' name='item_no' value='$item_no' /></td> </tr> <tr> <td>Item Name:</td> <td><input type='text' id='item_name' name='item_name' value='$name' /></td> </tr> <tr> <td>Item Description:</td> <td><textarea id='desc' name='desc' rows='10' cols='40'>$desc</textarea></td> </tr> <tr> <td>Item Type:</td> <td><input type='text' id='type' name='type' value='$type' /></td> </tr> <tr> <td>Value:</td> <td><input type='text' id='value' name='value' value='$value' /></td> </tr> <tr> <td>Gem Cut:</td> <td><input type='text' id='cut' name='cut' value='$cut' /></td> </tr> <tr> <tr> <td>Gem Color:</td> <td><input type='text' id='color' name='color' value='$color' /></td> </tr> <tr> <td>Gem Carats:</td> <td><input type='text' id='carats' name='carats' value='$carats' /></td> </tr>...
And the php page that is supposed to update is shown here:
<?php $cut = $_POST['cut']; $color = $_POST['color']; $carats = $_POST['carats']; $clarity = $_POST['clarity']; $size = $_POST['size']; $metal = $_POST['metal']; $other = $_POST['other']; $total = $_POST['total']; $certificate = $_POST['certificate']; $value = $_POST['value']; $angle1 = $_POST['angle1']; $name = $_POST['item_name']; $desc = $_POST['desc']; $item_no = $_POST['item_no']; $type = $_POST['type']; $angle2 = $_POST['angel2']; $dbhost = 'localhost'; $dbuser = 'jhrevell_jewelry'; $dbpass = 'jewelry123'; $conn = mysql_connect($dbhost, $dbuser, $dbpass) or die ('Error connecting to mysql'); $dbname = 'jhrevell_jewelry'; mysql_select_db($dbname); mysql_query ("UPDATE gallery SET cut = '$cut', color = '$color', carats = '$carats', clarity = '$clarity', size = '$size', metal = '$metal', other = '$other', total = '$total', certificate = '$certificate', value = '$value', image = '$angle1', name = '$name', item_no = '$item_no', type = '$type', image2 = '$angle2', desc = '$desc' WHERE id = '$_GET[id]'"); header('Location: http://midwestcreativeconsulting.com/jhrevell/manage'); ?>
But the desc field (the textarea one) is not working. I'm thinking it's because I have the php variable set on the form, but I'm not sure. Is there another way to do this? Please, can anyone help?
-
Can you explain? I'm not sure how to do that. Can you give examples or tell me how I find out the file system path?
-
I tried setting the folder with the images in it to 777. Do I need to set any other folders? The images within the folder are also set to 777.
-
Can someone tell me how I can remove or delete an image from a folder on a server using PHP? I tried this:
unlink("http://midwestcreativeconsulting.com/jhrevell/wp-content/themes/twentyten_3/upload/" . $location);
before my delete MySQL statement, but I keep getting this error:
Warning: unlink() [function.unlink]: http does not allow unlinking in /home/midwestc/public_html/jhrevell/wp-content/themes/twentyten_3/removejewelry.php on line 22
Can anyone help and tell me how I can make it work?
-
I am trying to add a second image upload to a form I have, but I can't figure out how to get the insert statement and upload statement working properly. The first file uploads and inserts to the database properly, but can anyone tell me how to add a second image to the mix? Here is what I currently have:
//if ((($_FILES["file"]["type"] == "image/gif") //|| ($_FILES["file"]["type"] == "image/jpeg") //|| ($_FILES["file"]["type"] == "image/pjpeg")) //&& ($_FILES["file"]["size"] < 20000)) // { if ($_FILES["file"]["error"] > 0) { echo "Return Code: " . $_FILES["file"]["error"] . "<br />"; } else { //echo "Upload: " . $_FILES["file"]["name"] . "<br />"; //echo "Type: " . $_FILES["file"]["type"] . "<br />"; //echo "Size: " . ($_FILES["file"]["size"] / 1024) . " Kb<br />"; //echo "Temp file: " . $_FILES["file"]["tmp_name"] . "<br />"; if (file_exists("upload/" . $_FILES["file"]["name"])) { echo $_FILES["file"]["name"] . " already exists. "; } else { move_uploaded_file($_FILES["file"]["tmp_name"], "upload/" . $_FILES["file"]["name"]); //echo "Stored in: " . "http://www.webdesignsbyliz.com/wdbl_wordpress/wp-content/themes/twentyten_2/upload/" . $_FILES["file"]["name"]; $image = $_FILES["file"]["name"]; $query = "INSERT INTO gallery VALUES ('', '$cut', '$color', '$carats', '$clarity', '$size', '$metal', '$other', '$total', '$certificate', '$value', '$image', '$name', '$desc', '$item_no', '$type', '$image2')"; $query_res = mysql_query($query) or die(mysql_error()); } }
I thought I could simply add a second move_uploaded_file line and replace "file" with "file2" (the name of my second file upload field from the form), but it's not working. Can anyone tell me the right way to do this, please? Thanks in advance! I'm not experienced with file uploads yet :-(
-
I tried to add a second file upload to my previously properly functioning form, but after adding it, now when I submit the form, it submits the data twice. It appears to be submitting the file right on the first insert, but on the second insert, the second image is not inserted, but just blank. Can anyone help me figure out why? I must have done something wrong in my insert statement or second file statement. Here is the page itself which contains the form:
http://midwestcreativeconsulting.com/jhrevell/add/
And below is my insert page:
<?php $dbhost = 'localhost'; $dbuser = 'username'; $dbpass = 'password'; $conn = mysql_connect($dbhost, $dbuser, $dbpass) or die ('Error connecting to mysql'); $dbname = 'jhrevell_jewelry'; mysql_select_db($dbname); $name = $_POST['name']; $metal = $_POST['metal']; $desc = $_POST['desc']; $item_no = $_POST['item_no']; $cut = $_POST['cut']; $color = $_POST['color']; $carats = $_POST['carats']; $clarity = $_POST['clarity']; $size = $_POST['size']; $type = $_POST['type']; $other = $_POST['other']; $total = $_POST['total']; $certificate = $_POST['certificate']; $value = $_POST['value']; //if ((($_FILES["file"]["type"] == "image/gif") //|| ($_FILES["file"]["type"] == "image/jpeg") //|| ($_FILES["file"]["type"] == "image/pjpeg")) //&& ($_FILES["file"]["size"] < 20000)) // { if ($_FILES["file"]["error"] > 0) { echo "Return Code: " . $_FILES["file"]["error"] . "<br />"; } else { //echo "Upload: " . $_FILES["file"]["name"] . "<br />"; //echo "Type: " . $_FILES["file"]["type"] . "<br />"; //echo "Size: " . ($_FILES["file"]["size"] / 1024) . " Kb<br />"; //echo "Temp file: " . $_FILES["file"]["tmp_name"] . "<br />"; if (file_exists("upload/" . $_FILES["file"]["name"])) { echo $_FILES["file"]["name"] . " already exists. "; } else { move_uploaded_file($_FILES["file"]["tmp_name"], "upload/" . $_FILES["file"]["name"]); //echo "Stored in: " . "http://www.webdesignsbyliz.com/wdbl_wordpress/wp-content/themes/twentyten_2/upload/" . $_FILES["file"]["name"]; $image = $_FILES["file"]["name"]; $query = "INSERT INTO gallery VALUES ('', '$cut', '$color', '$carats', '$clarity', '$size', '$metal', '$other', '$total', '$certificate', '$value', '$image', '$name', '$desc', '$item_no', '$type', '$image2')"; $query_res = mysql_query($query) or die(mysql_error()); } } //} // IMAGE 2 // //if ((($_FILES["file"]["type"] == "image/gif") //|| ($_FILES["file"]["type"] == "image/jpeg") //|| ($_FILES["file"]["type"] == "image/pjpeg")) //&& ($_FILES["file"]["size"] < 20000)) // { if ($_FILES["file2"]["error"] > 0) { echo "Return Code: " . $_FILES["file2"]["error"] . "<br />"; } else { //echo "Upload: " . $_FILES["file"]["name"] . "<br />"; //echo "Type: " . $_FILES["file"]["type"] . "<br />"; //echo "Size: " . ($_FILES["file"]["size"] / 1024) . " Kb<br />"; //echo "Temp file: " . $_FILES["file"]["tmp_name"] . "<br />"; if (file_exists("upload/" . $_FILES["file2"]["name"])) { echo $_FILES["file2"]["name"] . " already exists. "; } else { move_uploaded_file($_FILES["file2"]["tmp_name"], "upload/" . $_FILES["file2"]["name"]); //echo "Stored in: " . "http://www.webdesignsbyliz.com/wdbl_wordpress/wp-content/themes/twentyten_2/upload/" . $_FILES["file"]["name"]; $image2 = $_FILES["file2"]["name"]; $query = "INSERT INTO gallery VALUES ('', '$cut', '$color', '$carats', '$clarity', '$size', '$metal', '$other', '$total', '$certificate', '$value', '$image', '$name', '$desc', '$item_no', '$type', '$image2')"; $query_res = mysql_query($query) or die(mysql_error()); } } //} echo '<script language="Javascript">'; echo 'window.location="http://midwestcreativeconsulting.com/jhrevell/collections"'; echo '</script>'; ?>
Can anyone see what could be causing it to insert the record twice?
-
But there's no way to get to the FLA file if the other developer didn't upload it to the server in order to edit the images, is there?
And THANK YOU by the way!
-
Is there a way to grab the Flash code from this website and place it into another website without having to get the backend code (ie. using the View Source option)?
http://southfloridaboating.com/
I'm working for a client doing one website while another contractor is doing the above mentioned one, and they asked me if I can grab the Flash slideshow just from viewing the page, but I didn't see any way to. Is it possible?
-
I see your point, and you're right, you did tell me that. I am going to try to start doing that from now on. I'm just so used to opening in Safari on my Mac LOL Have to get out of that habit. Thank you so much for the extra help! I will take that zipped file and work from there. Thank you soooo much for the help! I really appreciate you!
-
I have a gradient being used on a sidebar on a website, but I need to to somehow stretch the length of the page. Is it possible to create a larger image of the gradient and resize it to fit the size of the rest of the content? Here is the website link:
http://webdesignsbyliz.com/s2design/
Can anyone advise me on the best way to do this?
-
Please help me out with this! I coded this site for Wordpress, but it's not lining up right in Firefox. It looks great in Safari. What have I done wrong? How can I fix this? Please help!
Here is the link to the site:
http://webdesignsbyliz.com/s2design/
Attached is how it looks in FireFox. :-(
The side green image and the navigation on the left are the problem :-( Any help would be greatly appreciated!
[attachment deleted by admin]
-
I have embedded a SWF file onto my webpage, and it displays just fine in Safari, but is not displaying in Firefox. Can anyone help me out with why and how to fix this? Here is a link to the page:
-
Thank you very much for the advice guys! Do they not have the option anymore for setting topics as resolved?
Setting Window Size When Opening SWF File?
in Other
Posted
Okay, thanks for the advice!