How Should I store images - Codeigniter - image

I'm contemplating on how to store images in my new site.
Should I save the images directly to the database
OR
should I upload them to my server, while storing the path in my database?
Also, should it be the second choice, how does one retrieve the path of a file he uploaded previously?

You should definitely go with the second option as you can take advantage of the user's browser caching these images after the initial request. It also means your database wont be hit constantly for large files which is always a bad thing.
In CodeIgniter there are various parameters you can use to get the name / full file path to store in the database.
See http://ellislab.com/codeigniter%20/user-guide/libraries/file_uploading.html
Also take a look at this great SO question Storing Images in DB - Yea or Nay?

I tried CI's own libraries , its good but not best, Image moo solved all my problems, uploading, resize, crop etc..
http://www.matmoo.com/digital-dribble/codeigniter/image_moo/

Related

How to download images for reduce network usage?

I am making android app that must show a lot of images from my REST API. I want to download images, and the next time check for images' name. If the image exists show them from the phone otherwise download from server.
Now I'm using Retrofit for my network requests and Glide for show images. But I have not good idea for solve this issue.
If needed I can change the network library or image loading library.
Thanks in advance
NOTE: This question might be too broad for the liking of S.O.
What you want to do is make what is known as a cache. The idea is that you have a unique identifier (often refered to as a key) for each object in the cache, such as an md5 sum of the image data, or original name + date of creation.
When you want to display an image, you first check if the image exists in the cache. If it exists simply return with the image from cache. if it does not exist, start the download and upon completion you insert the image into the cache.
Here is an example implementation that does what you want. I cannot vouch for it's quality because I never tried it.

Meteor JS image upload and display

I'm trying to build a E-commerce site with a admin page where the administrator can upload images of certain products.
I'd like Meteor to upload those images to a folder and then display those images in the product page of that product.
I know that normally the image files that the client will be using should be inside the 'public' folder, but I'd like to know more about what other options I might have.
Also, if I upload a new file to the 'public' folder or if I delete a file in the 'public' folder, the website refreshes itself...and this is good and bad at the same time depending on what effect you are after....
Here are my questions:
What if I create a 'uploads' folder in the server and upload the images to that folder. Would it be possible to display the images inside the 'uploads' folder in the client browser??? How??
Is there a way to use the browser to access the contents of the 'public' folder???
Is there a way to stop the 'reactivity' of the site if changes happen in the 'uploads' folder created?
Is uploading the images to the 'public' folder the best solution available to this problem?
Thank you very much for the help
When dealing with what will likely be a large number of images I like to offload not only the storage but also the processing to a third party.
My go-to app in this situation would be Cloudinary. Here's why:
Storage - I can store the original images outside of my application. A huge benefit to keep images in sync from dev to prod.
CDN - I get the extra benefits of images being quickly loaded from the Cloudinary CDN.
Off-load Processing - All of the processing of images is handled by Cloudinary which doesn't slow down my app as a whole.
Image Manipulation - I can make calls to the original image, calls to just get a thumbnail, and calls to change manipulate, ie :effect => grayscale. So if a 1000x1000px image was uploaded, I can request a 50x50px from Cloudinary that will return the image cropped to that exact size rather than using CSS to shrink a huge image.
Flexibility - I can change the size of images and return that exact size to the app without having to re-upload images. For example, if my product page pulled in thumbs at 40px, I could easily make a call to grab the same image at 50px.
Hope this helps.
http://cloudinary.com/
You can do all of this using the meteor package collectionFS. The package is well documented and you have a variety of options that you can uses for storing the uploaded files. CollectionFS also gives the ability for image manipulation on the upload, such as creating a resized thumbnail.
I realized this question is a bit old.
I had the same problem, one of the solution that works for me is using meteor-upload https://github.com/tomitrescak/meteor-tomi-upload-jquery
Definitely don't store stuff in the public directory - it will slow down starting up the app, and hot code refreshes on image upload could easily cause it to crash once there are a decent number of images in there.
Any of the above solutions with storing images elsewhere would work. One other option is using the peerlibrary:aws-sdk package to upload stuff to S3, which is what I use for several apps and have found to be very clean.
Storing the image as a base64 string in MongoDB is also a method. Useful for posting to APIs and save the worry of having to handle other 3rd Parties.

How to populate image thumbnails (image grid) on my web page using JSP

I wants to populate image thumbnails (image grid) on my web page using JSP. Please suggest the best way. Also please suggest what should I store in the DB, image in binary format or path of the image in text format ?
The correct answer would be It depends on your project requirements
I would like to write my experience, if the images had to be prevented from un-authorized access then database would be a good option, but ASAIK I haven't developed any such application in past 3 years. I would just prefer putting up the images in a folder and then have their name in DB for reference purposes.
I just thing database has more important information to store & retrieve and I don't want to choke the database connections retrieving images.

openreadAsync vs Bitmap for image downloading from server

I have some image urls which I want to cache locally and save so that I don't need to make a web request again and again as needed.
Now, I am confused whether there is any significant benefit of using webclient's openreadasync method over bitmap for fetching the image for first time for saving it to IsolatedStorage.
For me, I think bitmap would be a better option as I would be able to get a event for progress.
This post gives good info on various image caching options.
http://blogs.msdn.com/b/swick/archive/2011/04/07/image-tips-for-windows-phone-7.aspx
Matt mentioned the fact that default image caching only works per session. So if you are implementing your own Image caching, then you will have to implement a image downloader for which the WebClient OpenReadAsync provides a way to store file locally
If you were't considering a local cache, UriSource would have been the choice.
If you want to cache images beyond the current application instance lifetime, have a look at http://blogs.msdn.com/b/delay/archive/2010/10/04/there-s-no-substitute-for-customer-feedback-improving-windows-phone-7-application-performance-now-a-bit-easier-with-lowprofileimageloader-and-deferredloadlistbox-updates.aspx which will show a way of saving the images to IsolatedStorage and then display it from there. This means you won't have to get it over the network each time the app is run.
If you're using this for lots of images be sure to manage the images you save as well so you don't fill up the disk with lots of old images you'll never need again.

Joomla store files in database

I am using Joomla 2.5
I want to store user uploaded content (like images or general files) in the database instead of in the server.
Is there any existing setting which can be used to do this by default?
Note: I am interested in the user uploaded files. Joomla's own files can stay on the server or on in the database, either is fine by me.
The database doesn't store things like images, its stored information. Images and so on are always stored on the server. The only thing you could do is once an image is uploaded to the server, it stored information about it such as the format, dimensions etc in the database. Would be a good idea to use a gallery such as Phoca Gallery or JoomGallery. More can be found here.
If you are looking for a general file uploader then feel free to use my SWFUpload Component which is only for uploading in the admin backend however is a very simple component therefore will be easy to integrate into other components should you need to.

Resources