Jump to content

dromorkid

New Members
  • Posts

    6
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

dromorkid's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. There is a php file generateimage.php The code is as follows, maybe my problem is here? Can you have a look anyone and see, please! This is annoying me so bad. [code]<?php define(thumbnailWidth, "150");     $image = $_GET['image']; $src = ImageCreateFromJPEG($image); $width  = ImageSx($src); $height = ImageSy($src); $x = thumbnailWidth; $y = (int)(($x*$height) / $width ); $dst = ImageCreateTrueColor($x,$y); ImageCopyResampled($dst,$src,0,0,0,0,$x,$y,$width,$height); header('Content-type: image/png'); ImagePNG($dst); ?>[/code]
  2. Thanks, I'm understanding what you're saying, the logic of the whole thing. I know now that the files are not being stored on the database and I'm assuming where I see $_File that that indicates file system. Right? Anyway, to store them on the database what do I need to change this code to in order to store it database? I know this is a pain for you guys, but it'll be a major help to me. I spent eons using asp and now this comes along! Sorry. Oh and I'm pretty sure thats it not viewing the images where the problem is, its the upload as the error message appears after I click 'Submit'. Conor
  3. Ok, I'm aware I have posted no code, but I'm not sure what file deals with uploading images. I can paste the code here but there are a few files to choose from, so I will name you the files and hopefully you can tell me which ones would most likely contain the relevant code. Please forgive this tactless post. [u]File 1: generateimage.php [/u] <?php define(thumbnailWidth, "150"); $image = $_GET['image']; $src = ImageCreateFromJPEG($image); $width = ImageSx($src); $height = ImageSy($src); $x = thumbnailWidth; $y = (int)(($x*$height) / $width ); $dst = ImageCreateTrueColor($x,$y); ImageCopyResampled($dst,$src,0,0,0,0,$x,$y,$width,$height); header('Content-type: image/png'); ImagePNG($dst); ?> [u]File 2: setproduct.php[/u] <? require("../librequire.php"); $action = $_POST['action']; $imagefile = isset($_FILES['image']['name'])? $_FILES['image']['name']:'noimage.jpg'; $product = new Product( $_POST['name'],$_POST['manufacturer'],$imagefile, $_POST['address'],$_POST['city'],$_POST['state'], $_POST['zip'],$_POST['phone'],$_POST['url'],$_POST['comments'] ); if ($action == 'addrecord') { $results = $product->runQuery(0,'insert'); if($results) { if ($_FILES['image']['name']) { $uploadfile = $product_image_root . $_FILES['image']['name']; if (move_uploaded_file($_FILES['image']['tmp_name'], $uploadfile)) { $uploadstatus = "File " . '"' . $_FILES['image']['name'] . '"' . " successfully uploaded"; } } else { $uploadstatus = "No vessel image file uploaded"; } $sqlresults = "SQL Success: " . $product->num_rows . " Row(s) Affected (Product(s)Added)"; } else { $sqlresults = "SQL Fail: " . $product->num_rows . " Row(s) Affected (Product(s) Added)"; } } if ($action == 'modifyrecord') { $id = $_POST['id']; $results = $product->runQuery($id,'update'); if($results) { if (isset($_FILES['image']['name'])? $_FILES['image']['name']:'') { $uploadfile = $product_image_root . $_FILES['image']['name']; if (move_uploaded_file($_FILES['image']['tmp_name'], $uploadfile)) { $uploadstatus = "New File " . '"' . $_FILES['image']['name'] . '"' . " successfully uploaded"; } } else { $uploadstatus = "No new vessel image file uploaded"; } $sqlresults = "SQL Success: " . $product->num_rows . " Row(s) Modified (Product(s) Modified)"; } else { $sqlresults = "SQL Fail: " . $product->num_rows . " Row(s) Affected (Product(s) Modified)"; } } if ($action == 'deleterecord') { $id = $_POST['id']; $results = $product->runQuery($id,'deletebyid'); if($results) { $sqlresults = "SQL Success: " . $product->num_rows . " Row(s) Deleted (Product(s) Deleted)"; } else { $sqlresults = "SQL Fail: " . $product->num_rows . " Row(s) Deleted (Product(s) Deleted)"; } } ?> <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> <html> <head> <title></title> <link href="style.css" rel="stylesheet" type="text/css"> </head> <body> <div ID="sqlstatus"> <h1>Administration Results Page</h1> The following is the sql status for the operation:<br> SQL Results: <?= $sqlresults ?><br> Upload File: <?= $uploadstatus ?><br> </body> <hr> <div ID="menubottom">[ <a href="index.html">Admin Home</a> ||<a href="addproduct.php">Add Product</a>|| <a href="editproduct.html">Edit Product</a> ]</div> </div> [u]File 3: addproduct.php[/u] <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> <html> <head> <title></title> <link href="style.css" rel="stylesheet" type="text/css"> </head> <body> <h1>Add Product</h1> <table width="100%" height="370" border="0" cellpadding="0" cellspacing="0" style="background-image: url(images/page_structure/30_pack_jack_content_bg.gif); background-repeat:no-repeat;"> <tr> <td align="left" valign="top"> <br> <form enctype="multipart/form-data" name="form1" method="POST" action="setproduct.php"> <input type="hidden" name="action" value="addrecord"> <table align="center" border="0" width="400" cellpadding="2" cellspacing="0" id="contact"> <tr> <td align="right" valign="middle"><p><span class="required">*</span>Product Name: </p></td> <td align="left" valign="middle"><input name="name" type="text" class="formFieldReq" size="30"></td> </tr> <tr> <td align="right" valign="middle"><p><span class="required">*</span>Manufacturer Name: </p></td> <td align="left" valign="middle"><input name="manufacturer" type="text" class="formFieldReq" size="30"></td> </tr> <tr> <td align="right" valign="middle"><p><span class="required">*</span>Image: </p></td> <td align="left" valign="middle"><input name="image" type="file" class="formFieldReq" size="30"></td> </tr> <tr> <td align="right" valign="middle"><p>Street Address: </p></td> <td align="left" valign="middle"><input type="text" name="address" size="30"></td> </tr> <tr> <td align="right" valign="middle"><p>City: </p></td> <td align="left" valign="middle"><input type="text" name="city" size="30"></td> </tr> <tr> <td align="right" valign="middle"><p>State: </p></td> <td align="left" valign="middle"><select name="state"> <option value="AL">Alabama</option> <option value="AK">Alaska</option> <option value="AZ">Arizona</option> <option value="AR">Arkansas</option> <option value="CA">California</option> <option value="CO">Colorado</option> <option value="CT">Connecticut</option> <option value="DE">Delaware</option> <option value="FL">Florida</option> <option value="GA">Georgia</option> <option value="HI">Hawaii</option> <option value="ID">Idaho</option> <option value="IL">Illinois</option> <option value="IN">Indiana</option> <option value="IA">Iowa</option> <option value="KS">Kansas</option> <option value="KY">Kentucky</option> <option value="LA">Louisiana</option> <option value="ME">Maine</option> <option value="MD">Maryland</option> <option value="MA">Massachusetts</option> <option value="MI">Michigan</option> <option value="MN">Minnesota</option> <option value="MS">Mississippi</option> <option value="MO">Missouri</option> <option value="MT">Montana</option> <option value="NE">Nebraska</option> <option value="NV">Nevada</option> <option value="NH">New Hampshire</option> <option value="NJ">New Jersey</option> <option value="NM">New Mexico</option> <option value="NY">New York</option> <option value="NC">North Carolina</option> <option value="ND">North Dakota</option> <option value="OH">Ohio</option> <option value="OK">Oklahoma</option> <option value="OR">Oregon</option> <option value="PA">Pennsylvania</option> <option value="RI">Rhode Island</option> <option value="SC">South Carolina</option> <option value="SD">South Dakota</option> <option value="TN">Tennessee</option> <option value="TX">Texas</option> <option value="UT">Utah</option> <option value="VT">Vermont</option> <option value="VA">Virginia</option> <option value="WA">Washington</option> <option value="WV">West Virginia</option> <option value="WI">Wisconsin</option> <option value="WY">Wyoming</option> </select> </td> </tr> <tr> <td align="right" valign="middle"><p>Zip code: </p></td> <td align="left" valign="middle"><input name="zip" type="text" size="11" maxlength="5"></td> </tr> <tr> <td align="right" valign="middle"><p>Day Phone: </p></td> <td align="left" valign="middle"><input type="text" name="phone" size="30"></td> </tr> <tr> <td align="right" valign="middle"><p>URL: </p></td> <td align="left" valign="middle"><input type="text" name="url" size="30"></td> </tr> <tr> <td align="right" valign="middle"><p>Comments: </p></td> <td align="left" valign="middle"><textarea name="comments" cols="40" rows="5"></textarea></td> </tr> <tr> <td align="center" colspan="2"><input type="submit" value="Submit" class="button"> <input type="reset" class="button"></td> </tr> </table> </form></td> </tr> </table></td> <td width="10" background="images/page_structure/30_pack_jack_right_repeat.gif"> </td> </tr> </table></td> <hr> <div ID="menubottom">[ <a href="index.html">Admin Home</a> ||<a href="addreview.html">Add Review</a> || <a href="editreview.html">Edit Review</a> || <span class="chosen">Add Product</span> || <a href="editproduct.html">Edit Product</a> ]</div> </body> </html> [u]File 4: librequire.php[/u] <? require_once(getenv('CLASS_ROOT') . 'Base.php'); require_once(getenv('CLASS_ROOT') . 'MySQL_Access.php'); require_once(getenv('CLASS_ROOT') . 'CaptainsGuide_Admin.php'); require_once(getenv('CLASS_ROOT') . 'Review.php'); require_once(getenv('CLASS_ROOT') . 'Product.php'); require_once(getenv('CLASS_ROOT') . 'Advertiser.php'); //require_once('generateimage.php'); $review_image_root = getenv('DOCUMENT_ROOT') . '/' . getenv('REVIEW_IMAGE_ROOT'); $product_image_root = getenv('DOCUMENT_ROOT') . '/' . getenv('PRODUCT_IMAGE_ROOT'); error_reporting(E_ALL); ?> Sorry for this, I understand if this is way too much hassle for anyone. Help would be appreciated though Conor
  4. It says available only for Dreamweaver MX and MX2004, I'm using Dreamweaver 8. Will this work? Or is there another version?
  5. Hey I'm new to both php and this forum so bare with me if you will! I've just been landed with finishing up an excoworkers work and need help in uploading images to the database. I'm using DW 8 and the files are being stored on Plesk. I'm uploading the usual information to the database relating to products i.e. name, description, etc. I have no problem with inserting this information into the database but there is an image field that requires the user to upload an image to the database. Right now I'm baffled. I can browse my computer for the image no problem. My next interface is setproduct.php (I'm not sure if this guy created this page or took it from somewhere so maybe this is familiar to some of you). On this page it informs me of the information that has been uploaded successfully to the database. The image file is not being uploaded. When I check the database all the information is stored correctly in the their respective places INCLUDING the name of the image. This tells me that the image's pathway is there but the actual image file did not upload to the databse therefore its being displayed as a blank image. Is there some kind of add on that I need to use to upload the image? IS there code to upload the image? Can anyone help? PLease, I'd be more than grateful if someone could reply. Anything that is needed I can provide i.e. the code. The website is being stored on Unix. Heres hoping! Conor
  6. Hey I'm new to both php and this forum so bare with me if you will! I've just been landed with finishing up an excoworkers work and need help in uploading images to the database. I'm using DW 8 and the files are being stored on Plesk. I'm uploading the usual information to the database relating to products i.e. name, description, etc. I have no problem with inserting this information into the database but there is an image field that requires the user to upload an image to the database. Right now I'm baffled. I can browse my computer for the image no problem. My next interface is setproduct.php (I'm not sure if this guy created this page or took it from somewhere so maybe this is familiar to some of you). On this page it informs me of the information that has been uploaded successfully to the database. The image file is not being uploaded. When I check the database all the information is stored correctly in the their respective places INCLUDING the name of the image. This tells me that the image's pathway is there but the actual image file did not upload to the databse therefore its being displayed as a blank image. Is there some kind of add on that I need to use to upload the image? IS there code to upload the image? Can anyone help? PLease, I'd be more than grateful if someone could reply. Anything that is needed I can provide i.e. the code. The website is being stored on Unix. Heres hoping! Conor
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.