Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4057744
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T14:59:28+00:00 2026-05-20T14:59:28+00:00

Can you help me to edit this code? function insert_lenses(){ // to get userid

  • 0

Can you help me to edit this code?

function insert_lenses(){
    // to get userid
  $reg=$_SESSION['myusername'];
  $result_users = mysql_query("SELECT * FROM users WHERE user_name='$reg'");

  while($row_users = mysql_fetch_array($result_users))
    {
    $uid=$row_users[id];
    }

  $uploader = $_POST['uploader'];
  $path = 'photos/';
  $image=$_FILES['img_name'];
  $img_title=$_POST['title'];
  $img_tag=$_POST['tags'];
  $img_desc=$_POST['description'];
  $img_status=$_POST['status'];
  $lenses_id=$_POST['lenses'];
  $cam_id=$_POST['cams'];
  $date = date("d.m.Y");
  //------------------------------------------
  $image_size=$_FILES['img_name']['size'];
  $filename = stripslashes($_FILES['img_name']['name']);
  $extension = getExtension($filename);
  $extension = strtolower($extension);

  $image_name=time().'.'.$extension;
  $newname=$path.$image_name;
  $copied = copy($_FILES['img_name']['tmp_name'], $newname);


  if ($copied) {
    $sql=mysql_query("insert into images (uid, lid, imageurl, img_date, imagesize, imagedesc, imagetitle, imagetag, status,cam,lens,user_name,img_w,img_h)
VALUES('$uid','$lenses_id','$newname','$date','$image_size','$img_desc','$img_title','$img_tag','$$img_status','$cam_id','$lenses_id','$uploader','$w','$h')");



    return true;
  }else{
    echo "<center><h3>There are An Errors In Uploading!</h3></center>";
    return false;
  }
}


function getExtension($str) {
  $i = strrpos($str,".");
  if (!$i) { return ""; }
  $l = strlen($str) - $i;
  $ext = substr($str,$i+1,$l);
  return $ext;
}

$reg=$_SESSION['myusername'];
$result_users = mysql_query("SELECT * FROM users WHERE user_name='$reg'");

while($row_users = mysql_fetch_array($result_users))
  {
  $getid=$row_users[id];
  }

I need to add in this function RESIZE AND CROP IMAGE Like flickr and facebook img, I made a new folder: /img_croped

I want to insert the new image in this folder with ( resize and crop 58*58px )

and :

 mysql_query("insert into images (small_img) VALUES('$croped')"); // URL VALUE
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T14:59:29+00:00Added an answer on May 20, 2026 at 2:59 pm

    To resize and crop image,check below code which helps to crop image:

    <?php
       if( isset($_POST['submit']) ) {
          include('SimpleImage.php');
          $image = new SimpleImage();
          $image->load($_FILES['uploaded_image']['tmp_name']);
          $image->resizeToWidth(300);
          $image->resizeToHeight(200);
          $image->save('resizeImage.jpg');
          //$image->output();
       } else {
    ?>   <form action="" method="post" enctype="multipart/form-data">
          <input type="file" name="uploaded_image" />
          <input type="submit" name="submit" value="Upload" />
       </form><?php
       }
    ?>
    

    Check this link (dead) to find class of resize image and more detail.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

can anyone help me with this code. Everything is working fine except this piece
EDIT: This piece of code below is working. Unfortunately, i can't test those key
I have this code, how can I get the selected value of the @htmlDropDownList
Hey can anyone help me understand how to do an edit method for my
Feel free to edit the title, engrish can sometimes confuse instead of help. I
Anyone can help me? Trying to Add a Slow function with my smoothscroll and
Who can help me to translate this XML Schema pattern [0-9]+-([0-9]|K) to java regular
Perhaps you can help me find this in the docs. I'm using pound-quote to
Perhaps any of you can help me with this anoying problem. I have long
I have this code: window.onload= function() { window.scrollTo(0, 0.9); if (navigator.standalone) return; for (var

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.