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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T16:45:09+00:00 2026-06-14T16:45:09+00:00

I have been working hard in this app and have come into a problem

  • 0

I have been working hard in this app and have come into a problem of late. I am trying to store images (or paths to those images) in a database on my local network and retrieve them from my android application. I have been able to use PHP and JSON to retrieve text information but am not sure where to start for images. Should I store the actual images in the MySQL database or paths to images? How would I be able to keep them in a neat format? Any information you guys can offer is greatly appreciated.

  • 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-06-14T16:45:10+00:00Added an answer on June 14, 2026 at 4:45 pm

    Just store the path in a database. Create a simple table that might have the following fields:

    path – filepath or filename to the image on the server
    id – numeric auto_increment id that is useful while retrieving or identifying images
    width – optional, but might come in handy because storing height/width is quicker than calculating it upon retrieval
    height – same deal as width
    category – useful if you want to display more than one image a time, this could help you group them and decide which ones belong together. give the same category value for images that belong together

    In order to retrieve the information for a certain picture, you could call it in one of two ways. The most likely solution would be to retrieve images based on their filename.

    $con = mysql_connect('host', 'user', 'pass');
    $db = mysql_select_db('mydb');
    
    $imgName = 'picture.jpg';
    $getImg = mysql_query("SELECT * FROM mypics WHERE path='" . $imgName . "' ORDER BY id DESC LIMIT 1");
    $imgSrc = mysql_result("path", 0, $getImg);
    echo '<img src="' . $imgName . '" />';
    

    Of course this seems a bit useless, because we already know the filename to begin with because we are storing it in $imgName and using it to search the database for the entry, but you could search based on ID, category, width, or height all the same way. However, this will only retrieve the first image returned. Likewise, the images are being sorted by most recent because of the “ORDER BY id DESC” call. If you want to be able to retrieve all the images returned by the query simply remove the “LIMIT 1” from the query and change the “0” in mysql_result() to whichever entry you want to retrieve. Note that results are 0-indexed like arrays, so if you want the 5th result, you would get result 4.

    If you want to display all images in a category, you can do something like this:

    $con = mysql_connect('host', 'user', 'pass');
    $db = mysql_select_db('mydb');
    
    $getImgs = mysql_query("SELECT * FROM mypics WHERE category='android' ORDER BY id DESC");
    while( ($i = mysql_fetch_array($getImgs) ) {
        echo '<img src="' . $i['path'] . '" />';
    }
    

    This would display all images from the category “android”, starting with the most recent. Hope that helps.

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

Sidebar

Related Questions

Have been working on this question for a couple hours and have come close
I have been working on this app for at least 3-4 months and just
Background We have been working very hard to try come up with solutions for
I'm a beginner but have been working really hard to build this application. Working
I have been working very hard on figuring this out and just can't understand
I have been working on this sort of ATM (With a maximum of 50
I have been working with NSArray s and NSMutableArray s that store NSDate objects
I'm currently working on a web app, and have been inspired by a couple
I'm using Delphi 2009. In my program, I have been working very hard to
I have been struggling to get fetched properties working correctly in my app and

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.