Jump to content

Search the Community

Showing results for tags 'images mysql database'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to PHP Freaks
    • Announcements
    • Introductions
  • PHP Coding
    • PHP Coding Help
    • Regex Help
    • Third Party Scripts
    • FAQ/Code Snippet Repository
  • SQL / Database
    • MySQL Help
    • PostgreSQL
    • Microsoft SQL - MSSQL
    • Other RDBMS and SQL dialects
  • Client Side
    • HTML Help
    • CSS Help
    • Javascript Help
    • Other
  • Applications and Frameworks
    • Applications
    • Frameworks
    • Other Libraries
  • Web Server Administration
    • PHP Installation and Configuration
    • Linux
    • Apache HTTP Server
    • Microsoft IIS
    • Other Web Server Software
  • Other
    • Application Design
    • Other Programming Languages
    • Editor Help (PhpStorm, VS Code, etc)
    • Website Critique
    • Beta Test Your Stuff!
  • Freelance, Contracts, Employment, etc.
    • Services Offered
    • Job Offerings
  • General Discussion
    • PHPFreaks.com Website Feedback
    • Miscellaneous

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Age


Donation Link

Found 1 result

  1. Ok, Here is my use-case for my project. To facilitate the migration and ease of such migrations, I want to store my images in a database. Yes, I am aware of the downsides, but hear me out.. Ok, that code works just fine, I can upload an image to the database and display it in the application. However.....I also have the need for performance to do the following... 1) At time of login, grab the image from the database and store it to the filesystem. 2) This will enable me to reference the images in the application from the file system to speed performance. 3) it also enables me to build / include these images into PDF files which do not work with the retrieval method I created to display the images in the application. The db is a mysql database and my application is of course written in PHP. Here is the code that displays the image that was done via a file upload, that is stored in the database and displayed in a webpage (this works!) <?php $agency_id = $this->session->userdata('agency_id'); $baseurl = base_url(); $source = $baseurl."index.php?/agencys/upload_header_logo/retrieve/".$agency_id; ?> <img src="<?php echo ($source);?>" Here is the code I use for the above "upload_header_log/retrieve" method. function retrieve(){ $agency_id = uri_assoc ( 'retrieve' ); $query = "SELECT * FROM mcb_agency_header_images WHERE agency_id = '$agency_id'"; $result = mysql_query($query) or die(mysql_error()); // define results into variables $name=mysql_result($result,0,"name"); $size=mysql_result($result,0,"size"); $type=mysql_result($result,0,"type"); $content=mysql_result($result,0,"content"); // give our picture the proper headers...otherwise our page will be confused header("Content-Disposition: attachment; filename=$name"); header("Content-length: $size"); header("Content-type: $type"); echo $content; } I have tried to take the $content from the above and write it to a file, but it is always empty. How can I "get" that picture out of a database, and create that image as a file in the local file system when the agency user logs in? IE: reference it like this: <img src=http://www.myserver/website/images/agency/1/header/header.jpg/> Thanks in advance!
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.