(FULL) Stock Photo
(FULL) Stock Photo
(FULL) Stock Photo
SYNOPSIS
E-commerce shops have ingrained themselves into our daily lives. People
may now purchase online while relaxing in the comfort of their own homes
rather than going to a physical store thanks to technological advancement.In
today's digital age, visual content has become a cornerstone of online
communication and expression. From social media platforms to marketing
campaigns, captivating images play a vital role in capturing attention,
conveying messages, and evoking emotions.
1
1.1 SYSTEM SPECIFICATION
Processor : i3
Hard Disk : 5 GB
Memory : 1GB RAM
Frontend : Html5,CSS3,JavaScript
Backend : python
Database : XAMP Server
Operating System : Windows or any OS
Platform : Website
Code Editor : Visual studio Code
2
1.1.3 SOFTWARE DESCRIPTION
HTML5:
3
In summary, HTML5 stands as the bedrock of contemporary user
interface design, providing developers with a powerful set of tools to create
visually appealing, interactive, and accessible web experiences. Its continuous
evolution and broad adoption ensure that it remains at the forefront of web
development, shaping the digital landscape for both developers and users alike.
ADVANTAGES
IMPROVED SEMANTICS:
CROSS-BROWSER COMPATIBILITY:
4
RESPONSIVE WEB DESIGN:
GEOLOCATION API:
SIMPLIFIED CODE:
5
ENHANCED FORM HANDLING:
● New input types and attributes, such as email, url, and number, improve
form validation and provide a more user-friendly input experience. This
results in cleaner and more effective form implementations.
CSS3:
CSS3, the latest evolution of Cascading Style Sheets, plays a pivotal role
in enhancing the aesthetic appeal and responsiveness of web pages. Unlike its
predecessor, CSS3 brings forth a wealth of new features and capabilities that
empower designers to create visually stunning and dynamic user interfaces.
One of the prominent features of CSS3 is its ability to handle transitions and
animations seamlessly. Designers can now apply smooth transitions between
states and incorporate animations to captivate users and guide them through a
more engaging browsing experience.Moreover, CSS3 facilitates the
implementation of responsive design, allowing websites to adapt gracefully to
various screen sizes and devices. Media queries, a key component of CSS3,
enable designers to apply different styles based on the characteristics of the
user's device, ensuring a consistent and user-friendly presentation across
desktops, tablets, and mobile phones.
6
FEATURES
SELECTORS:
● CSS3 introduces new selectors, allowing more specific targeting of
HTML elements. This includes attribute selectors, nth-child
selectors, and more.
TRANSITIONS:
● CSS3 transitions allow smooth animations between property
changes. This is particularly useful for creating subtle and elegant
animations without relying on JavaScript.
TRANSFORMATIONS:
● CSS3 transformations, including rotate, scale, translate, and skew,
enable the manipulation of elements in 2D and 3D space, providing
a wide range of creative possibilities.
ANIMATIONS:
● CSS3 animations allow for more complex and dynamic animations
than transitions. Keyframes are used to define the animation
sequence, giving designers greater control over the animation's
timing and behavior.
7
FLEXBOX:
● The Flexbox layout model in CSS3 simplifies the design of flexible
and responsive layouts. It allows for the easy alignment and
distribution of space among elements in a container.
GRID LAYOUT:
● CSS3 Grid Layout provides a two-dimensional grid system for
designing complex layouts with rows and columns. It offers fine
control over the placement and sizing of elements.
MEDIA QUERIES:
● Media queries in CSS3 enable responsive design by allowing styles
to be applied based on the characteristics of the user's device, such
as screen width, height, and orientation.
CUSTOM FONTS:
● With CSS3, you can use the @font-face rule to include custom
fonts, expanding the range of typography options available on a
website.
VARIABLES:
● CSS3 introduces variables, allowing the definition of reusable
values. This enhances maintainability by centralizing commonly
used values in one place.
FILTER EFFECTS:
● CSS3 filter effects, such as blur, grayscale, and brightness, enable
the application of visual effects directly in the style sheet.
JavaScript, often hailed as the "language of the web," plays a central role
in powering interactivity and dynamic functionality on websites. As a versatile
scripting language, JavaScript enables developers to create responsive and
engaging user interfaces. Its ability to manipulate the Document Object Model
8
(DOM) in real-time allows for the seamless update and modification of content,
providing users with a dynamic and interactive browsing experience. Beyond
DOM manipulation, JavaScript facilitates asynchronous operations through
features like AJAX, enabling the retrieval and display of data without requiring
a page refresh. Additionally, JavaScript is crucial for form validation, user input
handling, and event-driven programming, making it an indispensable tool for
creating modern, client-side web applications. Whether animating elements,
responding to user actions, or fetching data from servers, JavaScript empowers
developers to build robust and user-friendly web applications that respond
dynamically to user interactions.
FEATURES
CROSS-BROWSER COMPATIBILITY:
● JavaScript is supported by all major web browsers, making it a
versatile language for building web applications that work
consistently across different platforms.
CLIENT-SIDE SCRIPTING:
● JavaScript primarily runs on the client side, allowing for dynamic
interactions within the user's browser without the need for server
requests for every action.
ASYNCHRONOUS OPERATIONS:
● JavaScript supports asynchronous programming through
mechanisms like Promises and async/await, enabling the execution
of non-blocking code and improving the responsiveness of web
applications.
DOM MANIPULATION:
● JavaScript interacts with the Document Object Model (DOM),
allowing developers to dynamically modify and update the
structure and content of web pages in response to user actions.
9
EVENT HANDLING:
● JavaScript facilitates the handling of user interactions, such as
clicks, mouse movements, and keyboard input, through
event-driven programming. This makes it possible to create
responsive and interactive user interfaces.
DYNAMIC TYPING:
● JavaScript is dynamically typed, meaning that variables can hold
values of any type, making it flexible and adaptable to different
scenarios.
JSON (JAVASCRIPT OBJECT NOTATION):
● JavaScript supports JSON, a lightweight data interchange format
widely used for sending and receiving data between a server and a
web application.
AJAX (ASYNCHRONOUS JAVASCRIPT AND XML):
● AJAX enables the asynchronous exchange of data between the
browser and the server, allowing for dynamic content updates
without requiring a full page reload.
ES6 AND BEYOND:
● ECMAScript 2015 (ES6) introduced several new features and
enhancements, including arrow functions, template literals, classes,
and destructuring assignments, improving the overall syntax and
capabilities of JavaScript.
10
WEB APIS INTEGRATION:
● JavaScript seamlessly integrates with various Web APIs, providing
access to browser functionalities, such as geolocation, local
storage, and canvas drawing.
SECURITY FEATURES:
● JavaScript incorporates security features like the Same Origin
Policy to prevent unauthorized access to resources across different
domains.
PYTHON:
FEATURES
11
enhancing adaptability in different contexts. The language supports multiple
programming paradigms, including object-oriented, procedural, and functional
programming, providing developers with diverse approaches to
problem-solving. Python's extensive standard library is a notable feature,
offering a wealth of pre-built modules that simplify the implementation of
common tasks, reducing the need for developers to start from scratch.
FLASK:
Flask, a micro web framework written in Python, has gained acclaim for
its simplicity, flexibility, and ease of use in web application development.
Designed to be lightweight, Flask empowers developers to build web
applications quickly and efficiently, without the constraints of a rigid structure.
Its minimalist core allows developers to choose and integrate components as
needed, making it an ideal choice for projects of varying complexity. Flask
embraces the concept of simplicity in its design philosophy, providing just what
is essential to get an application up and running. Despite its simplicity, Flask is
highly extensible, allowing developers to add features and functionalities
through a wide range of extensions. The Jinja2 templating engine, integrated
with Flask, facilitates dynamic content rendering. Flask's built-in development
server simplifies the testing and debugging process. With its active and
supportive community, Flask continues to be a popular choice for developers
seeking a straightforward yet powerful framework for building web applications
in Python.
12
FEATURES
JINJA2 TEMPLATING:
● Flask comes with the Jinja2 templating engine, which facilitates the
creation of dynamic and reusable templates for rendering content in
web applications.
13
HTTP REQUEST AND RESPONSE HANDLING:
● Flask simplifies the handling of HTTP requests and responses,
providing convenient access to request parameters and headers, as
well as facilitating the generation of HTTP responses.
WERKZEUG INTEGRATION:
● Flask is built on top of the Werkzeug WSGI toolkit, which provides
a solid foundation for handling web requests. This integration
enhances Flask's capabilities in request and response handling.
SECURE BY DEFAULT:
● Flask includes secure-by-default features, such as protection
against common web vulnerabilities like Cross-Site Scripting
(XSS) and Cross-Site Request Forgery (CSRF), ensuring a more
secure development environment.
WEBSOCKET SUPPORT:
● While Flask itself is designed as a request-response framework,
WebSocket support can be added using extensions or integrated
libraries, allowing real-time communication in web applications.
14
MySQL:
OPEN SOURCE:
● MySQL is open-source software, allowing users to access and
modify the source code freely. This fosters community
collaboration and ensures continuous improvement.
CROSS-PLATFORM COMPATIBILITY:
● MySQL is designed to work seamlessly across various operating
systems, including Windows, Linux, and macOS, providing
flexibility in deployment.
SCALABILITY:
● MySQL is highly scalable, accommodating the growth of data and
increasing demands by efficiently handling large datasets and high
traffic volumes.
15
HIGH PERFORMANCE:
● With optimizations for speed and efficiency, MySQL is recognized
for its high-performance capabilities, making it suitable for
applications with stringent performance requirements.
BACKUP AND RESTORE:
● MySQL provides tools and mechanisms for easy backup and
restoration of databases, ensuring data recovery and system
continuity in the event of data loss or system failures.
FULL-TEXT SEARCH:
● MySQL supports full-text indexing and searching, enabling
efficient searching of text data within database fields.
16
STORED PROCEDURES AND TRIGGERS:
● MySQL allows the creation of stored procedures and triggers,
facilitating the execution of predefined operations on the database
server, enhancing code reusability and maintainability.
PARTITIONING:
● MySQL supports table partitioning, allowing large tables to be
divided into smaller, more manageable pieces, improving query
performance and maintenance.
17
2. SYSTEM STUDY
OVERVIEW:
2.1.1 DRAWBACKS:
Limited User Interface: The user interface might lack modern design
elements and responsiveness.
Basic Features: The existing system may lack advanced features crucial
for a seamless user experience.
Scalability Concerns: The architecture might not be optimized for
handling a growing user base and increasing photo uploads.
Security Measures: Security features such as encryption and secure
authentication methods might need enhancement.
Performance Optimization: The system may not be fully optimized for
efficient data retrieval and processing.
18
2.2 PROPOSED SYSTEM
OVERVIEW:
The proposed system aims to address the drawbacks of the existing system and
introduce new features to enhance user satisfaction and system performance.
2.2.1 FEATURES:
19
3. SYSTEM DESIGN AND DEVELOPMENT
Input design involves creating forms and interfaces that enable users to
interact with the system. In StockPhoto, various input forms are designed for
tasks such as user registration, photo upload, and profile editing. Input
validation is implemented to ensure data accuracy and integrity.
20
DATABASE TABLES:
USERS TABLE:
PRODUCTS TABLE:
21
3. SEARCH AND FILTERING MODULE
22
8. ADMIN PANEL MODULE
Description: Manages the storage and retrieval of data in the MySQL database.
Key Features:
Stores information related to products, users, and transactions.
Ensures data integrity and reliability.
23
4. TESTING AND IMPLEMENTATION
4.1 TESTING
24
PHOTO UPLOAD AND PRODUCT MANAGEMENT:
4.2 IMPLEMENTATION
4.2.1 DEPLOYMENT
25
5. CONCLUSION
26
BIBLIOGRAPHY
● Flask Documentation. (n.d.). Retrieved from
https://flask.palletsprojects.com/
● Flask-SQLAlchemy Documentation. (n.d.). Retrieved from
https://flask-sqlalchemy.palletsprojects.com/
● Bootstrap Documentation. (n.d.). Retrieved from
https://getbootstrap.com/docs/4.3/getting-started/introduction/
● Python Werkzeug Documentation. (n.d.). Retrieved from
https://werkzeug.palletsprojects.com/
● SQLite Documentation. (n.d.). Retrieved from
https://www.sqlite.org/docs.html
● W3Schools - HTML Tutorial. (n.d.). Retrieved from
https://www.w3schools.com/html/
● W3Schools - CSS Tutorial. (n.d.). Retrieved from
https://www.w3schools.com/css/
● JavaScript MDN Web Docs. (n.d.). Retrieved from
https://developer.mozilla.org/en-US/docs/Web/JavaScript
● PostgreSQL Documentation. (n.d.). Retrieved from
https://www.postgresql.org/docs/
● SQLAlchemy Documentation. (n.d.). Retrieved from
https://docs.sqlalchemy.org/en/20/
27
APPENDICES
Level 0 DFD
28
Level 1 DFD - Upload Photo Process
29
B. TABLE STRUCTURE
Products Table
Users Table
30
C. SAMPLE CODING
def allowed_file(filename):
return '.' in filename and filename.rsplit('.', 1)[1].lower() in ALLOWED_EXTENSIONS
app = Flask(__name__)
app.config['SQLALCHEMY_DATABASE_URI'] = 'mysql://root:@localhost/stockphoto'
app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False
app.config['SECRET_KEY'] = 'sklee'
app.config['UPLOAD_FOLDER'] = 'static/imageNames'
db = SQLAlchemy(app)
class Users(db.Model):
id = db.Column(db.Integer, primary_key=True, autoincrement=True)
name = db.Column(db.String(255), nullable=False)
phone = db.Column(db.String(15), nullable=False)
password = db.Column(db.String(255), nullable=False)
imageName = db.Column(db.String(255), nullable=False)
products = db.relationship('Products', backref='saler', lazy=True)
class Products(db.Model):
id = db.Column(db.Integer, primary_key=True, autoincrement=True)
name = db.Column(db.String(255), nullable=False)
price = db.Column(db.Float, nullable=False)
description = db.Column(db.Text, nullable=False)
salerId = db.Column(db.Integer, db.ForeignKey('users.id'), nullable=False)
31
imageName = db.Column(db.String(255), nullable=False)
def allowed_file(filename):
return '.' in filename and filename.rsplit('.', 1)[1].lower() in ALLOWED_EXTENSIONS
# @app.before_first_request
# def create_tables():
# db.create_all()
user = Users.query.filter_by(name=name).first()
return render_template('login.html')
hashed_password = generate_password_hash(password)
profile_image = request.files['imageName']
32
new_user = Users(name=name, phone=phone, password=hashed_password,
imageName=filename)
db.session.add(new_user)
db.session.commit()
return redirect(url_for('login'))
return render_template('signup.html')
@app.route('/index')
def index():
if 'user_id' not in session:
return redirect(url_for('login'))
if not selected_photo:
return redirect(url_for('index'))
if request.method == 'POST':
# Process billing logic here (e.g., update database, handle payment, etc.)
# You may want to add a new table for billing transactions
# After processing, render the photobilling template with the selected photo
return render_template('photobilling.html', photo=selected_photo)
# If it's a GET request, render the photobilling template with the selected photo
return render_template('photobilling.html', photo=selected_photo)
if request.method == 'POST':
33
# Retrieve form data
name = request.form['name']
price = request.form['price']
description = request.form['description']
photo = request.files['photo']
photo.save(os.path.join(app.config['UPLOAD_FOLDER'],
secure_filename(photo.filename)))
return render_template('salephoto.html')
@app.route('/profile')
def profile():
if 'user_id' not in session:
return redirect(url_for('login'))
user = Users.query.get(session['user_id'])
@app.route('/edit_profile', methods=['POST'])
def edit_profile():
if 'user_id' not in session:
return redirect(url_for('login'))
34
user = Users.query.get(session['user_id'])
if not user:
return redirect(url_for('login'))
if request.method == 'POST':
new_name = request.form['new_name']
new_phone = request.form['new_phone']
db.session.commit()
return redirect(url_for('profile'))
@app.route('/delete_photo/<int:photo_id>', methods=['POST'])
def delete_photo(photo_id):
if 'user_id' not in session:
return redirect(url_for('login'))
photo_to_delete = Products.query.get(photo_id)
35
db.session.delete(photo_to_delete)
db.session.commit()
return redirect(url_for('profile'))
@app.route('/download_photo/<int:photo_id>', methods=['GET'])
def download_photo(photo_id):
# Fetch the photo based on the photo_id (adjust this based on your data model)
selected_photo = Products.query.get(photo_id)
if selected_photo:
# Provide the correct path to the image file in your UPLOAD_FOLDER
image_path = os.path.join(app.config['UPLOAD_FOLDER'],
selected_photo.imageName)
return send_from_directory(app.config['UPLOAD_FOLDER'],
selected_photo.imageName, as_attachment=True)
else:
flash('Photo not found', 'error')
return redirect(url_for('index'))
@app.route('/logout')
def logout():
# Clear the user_id from the session
session.pop('user_id', None)
# Redirect to the login page (adjust the route as needed)
return redirect(url_for('login'))
if __name__ == '__main__':
app.run(debug=True)
36
D. SAMPLE SCREEN
37
Profile Updating page
38
Photo selling page
39