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 7594329
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T21:23:22+00:00 2026-05-30T21:23:22+00:00

How can I upload an image in a registration form with image preview and

  • 0

How can I upload an image in a registration form with image preview and cropping tool using PHP yii framework?

I have a user registration form in my yii framework and want to include an image upload for the user image. I want that the image in uploaded and directly displayed in the form after the upload was successful. After that I want to resize and crop the image and when the create user form is submitted the image should be saved and the user record should contain the url to the image in order to display it later.

How can I set a fixed size for the image to be stored? I.e., when I want to have the image in width 200px x height 300px for example.

  • 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-30T21:23:23+00:00Added an answer on May 30, 2026 at 9:23 pm

    For live preview before updating you can use html5 File API.
    I advice you to look in these links:
    file-api-example
    https://developer.mozilla.org/en/Using_files_from_web_applications

    For cropping images on the server side, please use following yii extension:
    http://www.yiiframework.com/extension/image/

    You can also let the user crop image on the client side. You can define the fixed aspect ratio and let the select part of the image. I personally use Jcrop javascript library.

    You want to have the image to be 200px x 300px. AspectRadio is 0.67 in this case. You define aspectRatio in Jcrop:

    jcr = $.Jcrop('#imageDisplay');
    jcr.setOptions({
    trackDocument: true,
    aspectRatio: 0.74,
    

    Since your aspect ratio is fixed, you only have to resize the image to 200px x 300px using the mentioned extension.

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

Sidebar

Related Questions

I have a form where users can upload an image. I have another page
I have a site where I can upload an image, and i am using
I am using ASP.net(2.0) with VB.NET. I have a User registration form. On that
We have a webapp where people can upload various image file types and on
In a rather simple ASP.NET application where the user can upload a image, mostly
I can't seem to upload an image using Zend_Service_Nirvanix. Is it even possible? I
well I can upload image, mp3, mp4, .doc file etc with the following form.
I have a View where I can upload an image and the image is
I have a scenario where users can upload an image, OR a video (from
I have a website where the users can upload an image. However, before they

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.