The best way to manage images when importing from csv in prestashop - prestashop

I want to know the best way how to handle/manage our products images when we import products from csv in Prestashop 1.6. I mean, does Prestashop provide place/space to upload many images? or we must upload in external website (what website)?
May be this question is general enough, but when I googling I dont get the clear answer. Your answers I appreciate.

Newer PrestaShop versions support new storage architecture for pictures. This new system of image placement allows to work with images much faster, keeping them in order. Images are stored at /img/p folder, in created subfolders that correspond to image ID
Basically, you will avoid having 100,000 pictures in the same “/img/p” folder. Instead, the pictures will be placed into subfolders within “/img/p” directory (e.g.: “/img/p/1/2/ for image with ID 12 or /img/p/7/6/5/4/7 for image with ID 76547).

Related

Storing multiple Image in the directory and database

I'm making a small ecommerce project using Reactjs and SQL. I'm storing two different images shop(1) and user report(2)
I'm wondering if it's a good idea if I store the shop images in the directory itself like this
./public
./images
./shop
image1.png
image2.png
index.html
While the user report gets uploaded in the SQL as a blob
If the shop images are only used as static resources for your app, your example is the common way to do it.
However, if the shop images can be added/edited by users or if they shouldn't be visible to everyone, then you should store them in the database similar to the user report images.

How to upload and download media files using GUNDB?

I'm trying to use GUN to create a File sharing platform. I read the tutorial and API but I couldn't find a general way to upload/download a file.
I hear that there is a limitation of 5Mb of localStorage in GUN, if I want to upload a large file, I have to slice it then storage it into GUN. But right now I can't find a way to storage file into GUN.
I read the question from Retric and I know how to store the image into GUN, but can I store the other type of Files such as .zip or .doc File? Is there a general API for file storage?
I wrote a quick little app in 35 lines of HTML to demonstrates file sharing for images, videos, sound, etc.
https://github.com/amark/gun/blob/master/examples/basic/upload.html
I've sent 20MB files thru it, tho yeah, I'm sure there is a better way of splitting it up into 2MB chunks - that is currently not automatic, you'd have to code it.
We'll have a feature in the future that will automatically split up video files. Do you want to help with this?
I think on the download side, all you have to do is make sure you have the whole file (stitch it back together if you do write a splitter upper), and add it to some <a href=" target. Actually, I'm not sure exactly how, but I know browsers support download file attributes for a few years now, where you can create a download link even of a in-memory file... but you'll have to search online for how. Then please write a tutorial and share it with the community!!
I would recommend using IPFS for file storage and GUN to store the links to those files. GUN isn't meant for file storage I believe, primarily user/graph data. Thus the 5 MB limitation.

Deleting a folder of product images other than img/p/ ? Prestashop

I take in charge the reconstruction of an old Prestashop website. I am a newbie with this CMS and its files structure is still not clear in my mind.
When I copied the website from the live server to my localhost, I have the size of the img folder equal to 4.5Gb, but I noticed that I have a folder with a name: p_old with 1.75 Gb size.
The folder p is 2.8Gb size. According Prestashop documentation, this folder is by default the place where Prestashop put the uploaded pictures for the products.
As you know, optimizing the hard space used by the website has many paybacks (upload time, hosting server quota..). However, I cannot delete the p_old folder without asking experts (I am afraid the files inside are still used somewhere in the website).What do you think about it?
Your usual help and time are so much appreciated. Thanks in advance.
The p-old folder was manually named and/or renamed. PrestaShop hosts all of it's images in the img/p/ folder. Make sure to backup before any deletion. You should check your Preferences>Images and inspect the element of all pictures on the website to make sure it is all coming form the p folder and not the p-old folder.

Download large amount of images with objective-C

I'm currently developing an order entry application for my company. This means I need to download approximately 1900 product images to the iPad, and that's just the normal images. I also need to download an equal amount of thumbnails. The reason for downloading the images to the iPad instead of just displaying them from a given URL is that our reps wander into large stores which often don't have stable internet connections.
What would be the best course of action? The images are stored on our servers, but you need to be authenticated using Basic Auth before you can access those. I have thought of just downloading them one-by-one, which is tedious, or group them together on the server as a zip-file but that would be a large file.
A one-by-one is a valid options for the download. I have done projects with similar specs, so what I advise:
Use some 3rd party library to help you with the download of the images. MKNetworkKit for example. If you feel confortable enough, NSURLConnection is more than enough.
Store the images in the application sandbox.
Instead of downloading the thumbs, just create them on the go when you need them (Lazy pattern). Unless your image's thumbs are somewhat different than the original (some special effect).

iPad - how should I distribute offline web content for use by a UIWebView in application?

I'm building an application that needs to download web content for offline viewing on an iPad. At present I'm loading some web content from the web for test purposes and displaying this with a UIWebView. Implementing that was simple enough. Now I need to make some modifications to support offline content. Eventually that offline content would be downloaded in user selectable bundles.
As I see it I have a number of options but I may have missed some:
Pack content in a ZIP (or other archive) file and unpack the content when it is downloaded to the iPad.
Put the content in a SQLite database. This seems to require some 3rd party libs like FMDB.
Use Core Data. From what I understand this supports a number of storage formats including SQLite.
Use the filesystem and download each required file individually. OK, not really a bundle but maybe this is the best option?
Considerations/Questions:
What are the storage limitations and performance limitations for each of these methods? And is there an overall storage limit per iPad app?
If I'm going to have the user navigate through the downloaded content, what option is easier to code up?
It would seem like spinning up a local web server would be one of the most efficient ways to handle the runtime aspects of displaying the content. Are there any open source examples of this which load from a bundle like options 1-3?
The other side of this is the content creation and it seems like zipping up the content (option 1) is the simplest from this angle. The other options would appear to require creation of tools to support the content creator.
If you have the control over the content, I'd recommend a mix of both the first and the third option. If the content is created by you (like levels, etc) then simply store it on the server, download a zip and store it locally. Use CoreData to store an Index about the things you've downloaded, like the path of the folder it's stored in and it's name/origin/etc, but not the raw data. Databases are not thought to hold massive amounts of raw content, rather to hold structured data. And even if they can -- I'd not do so.
For your considerations:
Disk space is the only limit I know on the iPad. However, databases tend to get slower if they grow too large. If you barely scan though the data, use the file system directly -- may prove faster and cheaper.
The index in CoreData could store all relevant data. You will have very easy and very quick access. Opening a content will load it from the file system, which is quick, cheap and doesn't strain the index.
Why would you do so? Redirect your WebView to a file:// URL will have the same effect, won't it?
Should be answered by now.
If you don't have control then use the same as above but download each file separately, as suggested in option four. after unzipping both cases are basically the same.
Please get back if you have questions.
You could create a xml file for each bundle, containing the path to each file in the bundle, place it in a folder common to each bundle. When downloading, download and parse the xml first and download each ressource one by one. This will spare you the overhead of zipping and unzipping the content. Create a folder for each bundle locally and recreate the folder structure of the bundle there. This way the content will work online and offline without changes.
With a little effort, you could even keep track of file versions by including version numbers in the xml file for each ressource, so if your content has been partially updated only the files with changed version numbers have to be downloaded again.