Note that there are some explanatory texts on larger screens.

plurals
  1. POCreating a thumbnail from an uploaded image
    primarykey
    data
    text
    <p>I'm wanting to create a thumbnail from a user uploaded image so the image doesn't look squashed. But also would like a copy of the original image.. So I would like the original image to send the original image to my server and also create a thumb version and send it to my server so I can call each of them for each user that uploads their own image.</p> <p>My user table has 2 tables </p> <pre><code>`user_pic` longblob NOT NULL, `user_pic_small` longblob NOT NULL, </code></pre> <p>I'm not crash hot with the image side of coding but this is what I have so far. </p> <p>Imageupload.php</p> <pre><code>&gt; &lt;form id="myForm" action="include/media.profileimage.upload.php" &gt; method="POST" enctype="multipart/form-data" target="ifr1"&gt; &gt; &lt;input type = "file" name = "image_data" class = "input_text" style="width:800px;" &gt; &gt; &lt;input type = "submit" name = "submit" class = "btn_login" value = "Upload"&gt; &gt; &lt;/form&gt; </code></pre> <p>media.profileimage.upload.php</p> <pre><code>if(isset($_FILES['image_data'])){ if(is_uploaded_file($_FILES['image_data']['tmp_name'])) { // prepare the image for insertion $imgData =addslashes (file_get_contents($_FILES['image_data']['tmp_name'])); // get the image info.. $size = getimagesize($_FILES['image_data']['tmp_name']); // our sql query $creator_id = $_SESSION['id']; $sql = "UPDATE users SET user_pic='".$imgData."' WHERE id=$creator_id"; $sql2 = "INSERT INTO userphotos(photo_ownerid,photo_ispublic, photo_name, photo_caption, photo_imagedata) VALUES ($creator_id,1,'Profile Picture','Profile Picture','$imgData')"; // insert the image if(!mysql_query($sql)) { echo "Fail. It broke."; }else{ $c=mysql_query($sql2); echo "&lt;script&gt; parent.alert('Image Uploaded','',1000);&lt;/script&gt;"; } } } </code></pre> <p>Would appreciate any help or guidence. Thankyou </p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload