58407

Display multiple images from outside the public folder

Question:

Im working on a project, where I'd like to store photographs in a secured location for copyright reasons. Users can upload their photographs to a folder, outside the public route ('www').

For signed-in users, I'd like to allow to browse these photographs. I wanted to use 'imagecreatefromjpeg' and 'imagejpeg', but they could only fill the entire webpage. That would only be good, if I would want to open the images into a pop-up window. Instead of doing that, I'd like to have small thumbnails (generated on upload, also stored in private folders) all over my screen.

Is there any way to do that? Am I going in the worng direction with this?

Thanks for helping me out.

Answer1:

You can cache thumbnails of the submitted images with php gd

<a href="http://www.fliquidstudios.com/2009/05/07/resizing-images-in-php-with-gd-and-imagick/" rel="nofollow">http://www.fliquidstudios.com/2009/05/07/resizing-images-in-php-with-gd-and-imagick/</a>

Then create a image.php file that will serve images (put in your own authentication to secure access) that will end with imagejpg($im).

Then in your html, just put something like:

<img src="images/image.php?id=123" width="100" height="100">

Recommend

  • Display an image after resizing
  • Broken Cyrillic file name when uploading to server
  • No orientation in exif data - PHP image upload
  • PHP Keep exif data using imagecopyresampled
  • Upload image without losing quality
  • Passing file path to php script
  • Watermark text using imagettftext
  • test driven asynch tasks
  • Polymer 1.x + Firebase 2.x: How to push or put data to Firebase using Polymerfire?
  • GAE Models: How to list child nodes in parent
  • multiple colors on beanplot in R
  • Excel - import data from an online xls file daily
  • Phonegap Android App, open links within app?
  • How to browse android SDK sources in Android studio 2.0
  • input type=“file” accept=“image/*” doesn't work in phone gap?
  • How to process binary stream in Wicket like Servlet?
  • IIS 7.5 404 Error for .PDF files
  • Android - Call default browser with and redirect to a designated url
  • UIBarButtonItem's action is not called when in a view with a UIGestureRecognizer
  • C++/CLI Thread synchronization including managed and unmanaged code
  • Programatically open file in visual studio
  • using System.Speech.Synthesis with Windows10 universal app (XAML-C#)
  • quiver not drawing arrows just lots of blue, matlab
  • Suppressing passwd when calling sqlplus from shell script
  • SharedPreferences or SQLite Database?
  • Alternative to overridePendingTransition() - Android
  • Using $this when not in object context
  • Retrieving value from sql ExecuteScalar()
  • C# - Is there a limit to the size of an httpWebRequest stream?
  • Uncaught Error: Could not find module `ember-load-initializers`
  • How to make a tree having multiple type of nodes and each node can have multiple child nodes in java
  • Resize panoramic image to fixed size
  • How to convert from System.Drawing.Color to Excel.ColorFormat in C#? Change comment color
  • Cassandra Data Model
  • vba code to select only visible cells in specific column except heading
  • Properly structure and highlight a GtkPopoverMenu using PyGObject
  • Matrix multiplication with MKL
  • Codeigniter doesn't let me update entry, because some fields must be unique
  • Programmatically clearing map cache
  • How to get NHibernate ISession to cache entity not retrieved by primary key