What is the best place to store module uploaded images - prestashop

I am creating a module that allows to create some objects and upload images for them.
For the moment, I am uploading images in the module folder itself. But I think it is better to store them in PS img folder like for product and category images. One of the reasons is to avoid their deletion when module is deleted mistakenly from backoffice.
Is there any other reason to store/ not store images in img folder? What is the best place to store a huge number of uploaded images?
Your ideas are much appreciated. Thanks in advance.

Yes, it's better to save your images in the img folder. The most important reason for doing this: this route will never be blocked by robots.txt.
In my modules, (in order to be more orderly,) I create a folder called "module" and then inside this folder, I create another folder called the my-module-name.
img/modules/my-custom-module/test.jpg

Related

In UWP app, where should html assets be stored in the assets directory?

In a UWP app using cppwinrt I want to use WebView to display contents of a book kept in the Assets folder. I read that it is necessary to reference an html asset this way for use as a Uri argument to the Navigate method in web view:
TheWebView.Navigate(Uri(L"ms-appx-web:///SampleBook/PageOne.html"));
This produces an empty view, while
TheWebView.Navigate(Uri(L"ms-appx:///SampleBook/PageOne.html"));
crashes. Msdn says that for files "that will be loaded into the web compartment" one must use ms-appx-web, and I've seen mention that this is a security issue. But does that mean the files are in a special location within the project - i.e. not merely in the Assets folder - or does it only mean that the path must begin with ms-appx-web independent of the file's location? "Web compartment" is not explained but seems to be not a location but rather a classification of the type of resource. At any rate, neither of the above approaches works, so I'm curious to know the recommended way to store and access a collection of html files in the package. In the assets folder? A special folder within assets? In Solution Explorer the html file is listed, "content" is True, and the file is Included In Project. Thanks.
My mistake: ms-appx-web does not point to the assets folder, but to its parent. The correct path for content of this type would be ms-appx-web///Assets/SampleBook/PageOne.html. The reference to material to be "loaded to the web compartment" apparently is just a way of saying: stuff to be loaded with WebViewer.

Moving uploaded files in Socialengine

I tried moving uploaded file through browse action in socialengine from /public/user/ to /Files/SE/ by using
1.
$fileobj = new Zend_Cloud_StorageService_Adapter_FileSystem();
$fileobj->moveItem($sourcePath, $destinationpath);
move_uploaded_file($sourcePath, $destinationpath);
Both of these couldn't move the file. I have checked the paths too they are perfect and works with other frameworks
You should use API of Storage module which will allow you to create temporary files (when you need to resize images or convert videos) and then place them into public storage. This files will be tracked in engine4_storage_files table.
I got it worked by using createSystemFile() function under storage > Model > DbTable > Files.php
I created a function similar to this and gave parent_type as the folder which I wanted to move in the files.

iOS file system: adding/removing/sorting files

I have a directory with images like this:
0000.png
0001.png
0002.png
0003.png
etc...
To add an image, I query the count of the directory and name the new file with the count. I need to maintain such an order because these images are eventually displayed in a grid view. This is the easy part. What is bugging me is manipulating the directory later.
The user can delete and reorder these as they wish. So how should I handle reordering of the actual directory?
I have tried, naively, copying the images into an NSMutableArray, loading those into the gridView, letting the user manipulate, then upon finish I wipe the directory and rewrite the images. That's fine for a few images, but there can be many and it slowly builds up.
I like the idea of copying the images locally, manipulating and then fixing the directory. But I think there has got to be a better way to manage the directory instead of wiping and rewriting, would it be faster to write some kind of file-swapping method?
Instead of writing the images to the file system in an ordered format, you could have a meta data file images.plist
And maintain an NSMutableArray of NSDictionaries
Each dictionary will contain the data for the imageFile Path and the image index
Then when you would save the changes of the user you will only rewrite this plist file, instead of saving all the images again

typo3 file saving from backen with dynamic path

I have to save some posts with images. i create a directory for each post and save images there, but in backend if i edit/save the post the relation between images and post dies, any ideea how can i configure the saving path for the backend?
thanks anticipated.
i guess you forgot to set the directory also in file: ext_emconf.php
its not done when only creating the dir in the extension itself. this maybe is your (or typo3) problem
go into file: ext_emconf.php: and edit the array 'createDirs' => '

ProcessingJS - loadImage() and loadStrings() path problem

I have a path problem when using loadImage() and loadStrings() in Processingjs. I would like to have my sketches and their associated files (images, text files) in one place and to be able to call them from another on my site.
For example, I am trying to run a Processingjs sketch located at
www.example.com/sketches/mysketch.pde from the page www.example.com. This works fine when there are no external files.
Alas the problem starts when I need to use loadImage() and loadStrings() to look for images and texts to load. It defaults to www.example.com/image.jpg and not to the sketch location, www.example.com/sketches/image.jpg.
The need for #pjs preload makes matters worse.
Without moving the files and without hardcoding, is there a way to
tell Processingjs to look for the files to load in the same folder as
the .pde and not the .html?
I hope this is clear. Any help would be appreciated!
Short answer: no.
Even native Processing won't behave the way you want in this sense, because you'll be executing your sketch from [...]/sketches/ and any resource call is local to that directory.
Similarly, with processing.js your resources are located relative to the "directory" you're in, which for www.example.com/ is just the base dir. What you can do, however, is place your .pde file in the same dir as your .html file, or vice versa.
#pjs preload is necessary to effect "immediate" file loading. If you don't preload it, your sketch will have to deal with asynchronous load instructions. Quite literally, loadImage without a preload directive behaves the same as requestImage (http://processing.org/reference/requestImage_.html)