VBA photo/image compression - ms-access

I am wondering if this is possible and within the realms of Access?
I currently have a database system where the user can open up directories/folders related to the record; such as images, docs etc...
This avoids bloat by attaching the images to the records and what not, and works fine.
A user enhancement would be to allow the user to automatically compress photos so that they are more appropriate in file size to attach to emails.
I was wondering if it would be possible to, say whilst using the FileSystemObject and CopyFile, copy the photos from one folder (/photos) to another folder (/compressed_photos) and compress them at the same time.
Could I use "VBA.Shell" and run a batch image compression program on the photos?
Any advice on the above is greatly appreciated, even if it is just to confirm that it is not possible.
Cheers
Noel

A simple solution would be to use ImageMagick via Command Line. See the examples on the manual pages there.

Related

Right way to manage application generated files

tl;dr
In my node.js application I create pdf documents. What is the best/right way to save them? Right now I use node.js fileserver and shell.js to do it.
I am working on a node.js web application to manage apartments and tenants for learning purpose and on some point I create PDF Documents that I want to save under a path
/documents/building_name/apartment_name/tenant_name/year/example.pfd
Now if the user wants to change the building, apartment or tenant name via an http PUT request I change the database but also the want to change the path.
Well both works but I can't write good tests for these functions.
Now a friend told me that it's a bad practice to save documents on a file server and I better should use BLOB.
On the other side google doesn't really agree on using blobs
So what is the right way to save documents?
Thanks
Amit
You should first define a source of truth. Unless you're legally obliged to keep copies of those files and they are not being accessed very often, I wouldn't even bother storing those at all and just generate them upon request.
If not, keep the DB clean, blobs will make it huge. Put them into cold storage (again assuming they are not being accessed too frequently) without those paths. If the paths are reliant on often changing information, that can't be performant for neither the file server nor your system.
Instead store a revision number in your DB that the file can be found under and limit the path structure to information that rarely change.
Like {building}/{apartment}/{tenant}_{revision}.pfd
That - depending on your backup structure - will allow you to time-travel if necessary and doesn't force a re-index all the time.
Note: I don't know too much about your use case.

Search and Replace in PHPMyAdmin database for Wordpress (absolute beginner)

I apologise in advance for I know that this question has been asked several times already, but being a complete beginner at wordpress coding and database handling, I am still not sure about what those answers really meant.
So having just coded a website and converted it into WordPress, I now find myself having to change all of the localhost strings to the accurate ones, but with hundreds to go through, I just wanted to know if any of you were able to recommend a program or technique within PHPMyAdmin (that I may not be aware of) to avoid having to change them one at a time.
Thank you all in advance for your time and attention.
First, let me start by saying this is very dangerous, especially for an absolute beginner such as yourself. Please use this with extreme caution as you can potentially bring the entire site down by replacing values in your database with the wrong data.
With that said, there is a script specifically designed for doing search and replace on the WordPress MySQL database. http://interconnectit.com/products/search-and-replace-for-wordpress-databases/
Here's the direct download link: https://github.com/interconnectit/Search-Replace-DB/archive/master.zip
You will extract the folder from the donwloaded zip, then upload the folder to the root of your WordPress install. Once its uploaded just reference the folder in the browser. I always rename the folder to sr (shorthand for search and replace) so its easier to write out the full URL. So as an example, once its in the root of the WordPress install you'd access it like www.example.com/sr/.
After you access the script in the browser, you'll have a GUI with two boxes at the top. The first you'll enter the string you're searching for, and the replace string goes in the second box. Your MySQL details/login should already be populated. After entering your S&R terms scroll down and click "Update Details", then do the "Dry Run" option first. It'll run through the database and show you the values that will be changed. If you are satisfied with the changes, click "Live Run".
Depending on the database size it'll take just a short time to complete. This is the easiest way to S&R the WordPress database.
Important: for security reasons you'll want to delete this folder from your server after you have finished using it. You don't want a database S&R utility just lingering around for no reason.
Another possible option if you're familiar with WP-CLI is to use the wp search-replace command: https://developer.wordpress.org/cli/commands/search-replace/ This would be done through Terminal or another command line utility.
In phpMyAdmin open your table, choose Search > Find and replace. Then specify in which column you want to find and replace, and the original and replacement texts.
Without any doubt I would use http://interconnectit.com/products/search-and-replace-for-wordpress-databases/
This tool is especially designed for the situation you describe.
You upload the code to your server and then enter the "find" and "replace"
You can then do a dry run and the system will show you all the replaces that will be made across every single table in your Wordpress database.
Once you're happy then you can do a live run and the changes are made.
I have used this on probably one hundred Wordpress sites and it works a charm.

Where to save users comments of an item?

Basically I have a web app which it contains items and the people can comment on it and tell what they think about it. just like youtube videos or any other similar website.
Question
Where is the best place to save these comments. Do I Create a table in MySql database and save it there or do I save it in a .txt file and then save the location of the file on the database. I would really appreciate if someone tell me which is good from performance perspective or is there any alternative better way.
Much appreciations.
Save the comments directly in database.
Adding a comment in file and saving the path in database is not good you are adding extra work.
Reading from database is easy and more professional as every where it is in use. In YouTube as well.
There is chance someone delete your file and you will lose your data.
Clearly the database. They were build to replace the unpleasant storage of data in flatfiles also for performance reason.
You need to save the comments in the database. It is easier to query and sort the comment later on. Despite save as .txt, it is safer to save it in database.

Saving pictures in the a MySQL DB vs saving it as file

I know this question was asked in various ways here, but none of the answer is conclusive.
I have a system which among other things updates a website gallery.
I can both "upload" the file to the website (and save a copy at the system - needed) or just save it in the DB and save the space (and another upload). If I go with the files I would need to "notify" the webpage of every change (picture delete, add or change) instead of just making the change in the DB.
So:
If we are talking about a standard website with a picture gallery, is it best to save the pictures as pictures or in the DB?
If the webpage is very visited or very large, does it makes any difference?
Is the difference that significant? Or just go with the convenient way?
Although I presented my case I would like also to have a "more in general" answer, what is the "good" approach when talking about saving files.
Thanks in advance for clarifying it,
Michel.
Only put structured data in a DB. Images are files and should be kept on a files system. The performance of the DB will degrade more and more as the number of pictures / users grows. Instead create an image object which you can use to track the image location and meta data.
I have had the same problem with you in a previous project of mine.
I decided to go with only storing the path of the image in my database (which is just a string) and save the image in the file system, not in the DB.
This is the best practice in many ways.
It keeps your DB small, getting a large amount of rows is faster and DB back ups are significantly smaller.
Just put the images in a file and save the path in the DB so you can retrieve it later.

whats best way to create documents Archive of images in the database's?

What is the best way to create an Archive of image documents in the database ?
Given we have about 2-10 million records and each record includes 2-4 images and about 20 text fields , what is the best way for create this archive so that we have good speed and high security for data?
Also, what database is good for this project?
Definitely use the file system as Minor suggested.
One option is SQL Server FILESTREAM. See http://msdn.microsoft.com/en-us/library/cc949109.aspx.
Use file system storage for archive image. You must save link in DB for the image file. And if you use a HTTP content you can use the cache proxy server such as Squid, Nginx, etc.
More questions for you:
How dynamic is the data? Do you store it once and never change it or it gets frequently changed?
Do you need versioning for the documents or the latest version overwrites the previous and that's it.
Are the documents always edited using one application or they can be changed outside (ex: using Word)
Are the documents related to other "non-document" data (database rows) or is it the only thing that you need to store?
File system won't offer any real security, so I would discount that straight off.
In Oracle there is built-in image support through the ORDImage type.
Check out Marcel's blog as he, and the Piction company, do a lot of work in this area and he has lots of useful material to download.
You can use control downloads. Look at http://kovyrin.net/2006/11/01/nginx-x-accel-redirect-php-rails/lang/en/