
kclark
Members-
Posts
38 -
Joined
-
Last visited
Never
Profile Information
-
Gender
Not Telling
kclark's Achievements

Newbie (1/5)
0
Reputation
-
same page. I know nothing about javascript.
-
Here is the code that I am working with. This will correctly pull the panels that I need for a particular company and put them in a list box. How can I get my image to change upon selection? <?php $panels = "select * from panels where company = " . $_GET["company"] . " order by name"; $result = mysql_query($panels); $num_rows = mysql_num_rows($result); if($num_rows == 0) echo ""; else { echo "<select>"; // printing the list box select command while($nt=mysql_fetch_array($result)){//Array or records stored in $nt echo "<option value=$nt[panelid]>$nt[name]</option>"; /* Option values are added by looping through the array */ } echo "<br></select>";// Closing of list box } ?>
-
Using php I have a dynamically filled select box with the names of images. How can I get an image box on my page and change upon selection?
-
Nevermind got it working. Thanks for the help. BTW. this was my finished code for everyone else. My other error was something different, but all is great now. { $query = "DELETE from products where productid = '$productid'"; if(file_exists("images/" . $productcompany . "/" . $productnumber . "_th.jpg"")) unlink("images/" . $productcompany . "/" . $productnumber . "_th.jpg""); if(file_exists("images/" . $productcompany . "/" . $productnumber . ".jpg"")) unlink("images/" . $productcompany . "/" . $productnumber . ".jpg""); }
-
I tried that, but now it deletes the thumbnail but not the larger image. When I delete, my actual product information is not being deleted either. { $query = "DELETE from products where productid = '$productid'"; if(file_exists("images/$productcompany/$productnumber.jpg")) unlink("images//$productname/{$productnumber}_th.jpg"); }
-
I have a delete statement to delete images, but I also want it to delete the thumbnail image as well. $query = "DELETE from products where urnid = '$urnid'"; if(file_exists("images/$product.jpg")){ unlink("images/$product.jpg")} Is there a way to delete the product_th.jpg image?
-
I got it figured out. These lines: $o_path = "images/" . $companyname . "/" . $materialdir . "/";//line 144 /* $s_path is the path where you want to save the new image INCLUDE trailing slash */ $s_path = "images/" . $companyname . "/" . $materialdir . "/"; They both said $o_path. Now it works, thanks a bunch
-
The image did get upload, but no thumbnail Getting the following errors:
-
my page was working fine until I replaced my original upload script with that provided. My first post was my original script that worked fine. I wanted to add the thumbnail so I came here. I changed my original to what I posted the 2nd time just above. I have error reporting turned on but not getting any error, just blank page.
-
I am getting an error, Blank page that is. if($form == "Delete Casket") echo ""; else { /* put this at the top of your upload script */ include('resize.php'); 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("images/" . $_FILES['file']['name'])){ echo $_FILES['file']['name'] . " already exists. "; }else{ move_uploaded_file($_FILES['file']['tmp_name'], "images/$companyname/$materialdir/$prefix$modelnumber.jpg"); echo "Stored in: images/$companyname/$materialdir/$prefix$modelnumber.jpg"; /* define the resizing parameters */ /* $file is the name of the original image WITHOUT the path */ $file = $prefix . $modelnumber . "jpg"; /* $save is the name of the resized image WITHOUT the path */ $save = $prefix . $modelnumber . ".jpg"; /* $t_w is the MAXIMUM width of the new image */ $t_w = 800; /* $t_h is the MAXIMUM height of the new image */ $t_h = 600; /* $o_path is the path to the original image INCLUDE trailing slash */ $o_path = "images/" , $companyname . "/" . $materialdir . "/"; /* $s_path is the path where you want to save the new image INCLUDE trailing slash */ $o_path = "images/" , $companyname . "/" . $materialdir . "/"; /* NOTE: to overwrite the original with the new, use the same name and path for both */ /* resize original to be within the sizes specified -n $t_w and $t_h */ //Resize_Image($save,$file,$t_w,$t_h,$s_path,$o_path); /* make a thumbnail version */ $t_w = 100; $t_h = 120; $save = $prefix . $modelnumber . "_tn.jpg"; Resize_Image($save,$file,$t_w,$t_h,$s_path,$o_path); } } $photo = "images/$companyname/$materialdir/$prefix$modelnumber.jpg"; //$photo = "images/" . $companyname . "/" . $materialdir . "/" . $prefix . $modelnumber . ".jpg"; $thumbnail = "images/" . $companyname . "/" . $materialdir . "/" . $prefix . $modelnumber . "_th.jpg"; }
-
What if I don't want to resize the uploaded file only the thumbnail
-
How do I do this?
-
that tells me how to resize, but how can I upload 1 file and use it twice in the same upload
-
I am using the following code to upload images for my products. How can I modify it to not only upload the product image, but upload it a 2nd time resized for thumbnail or is it even possible? 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("images/" . $_FILES['file']['name'])) { echo $_FILES['file']['name'] . " already exists. "; } else { move_uploaded_file($_FILES['file']['tmp_name'], "images/$companyname/$materialdir/$prefix$modelnumber.jpg"); //"images/" . $companyname . "/" . $materialdir/$prefix$modelnumber . ".jpg"); //"images/" . $_FILES['file']['name']);//change to Timp folder // "C:/upload/" . $_FILES['file']['name']);//change to Timp folder //echo "Stored in: " . "C:/xampp/htdocs/Timp/UserLogin/upload/" . $_FILES["file"]["name"]; echo "Stored in: images/$companyname/$materialdir/$prefix$modelnumber.jpg"; } } $photo = "images/$companyname/$materialdir/$prefix$modelnumber.jpg";