I am using hooks to update some data when the user uploads a file.
One of the use-cases is that we want to generate a "preview-image" from the input data, upload it and attach it to the item.
https://docs.directus.io/extensions/hooks.html#creating-hooks
How can I access the API or create/save a directus file entry within the hooks?
You should be able to use the API normally within a hook. So you can use the "Create File" endpoint to upload the preview image, within a blocking files.create.before (in v9).
https://github.com/directus/next/blob/main/docs/guides/extensions/api-hooks.md
That said, Directus will automatically create preview images using the thumbnailing system... so you shouldn't even have to build this custom.
https://docs.directus.io/guides/files.html#asset-middleware
Related
I am trying to figure out a way to update one of the static files in my react native project.
The requirement being after client downloads the app, we can either update the app using code-push (I just want to update some static files).
Or maybe create some resource pack kind of thing, so that when user clicks on download/update resource, the file gets downloaded or updated.
So, how do I create this resource pack thing, whose content are being used in the app, consider I want to update an logo. So, downloading it, and then using that image instead of the old one.
Or any other alternatives are welcome.
I created a plugin for IP 3.9 to upload videos to encoding.com and convert them to mp4 so users would not have to worry about the format of the videos to use in their html5 sites.
In the previous version of ImpressPages I used the element_file of the ItemsArea class to upload the original videos to a temp folder, once the video was encoded I would put it in the Repository so it is available to the users for embedding using a widget.
In the new Impress Pages 4 Grid class the element_file was replaced for the RepostoryFile field and it directly uploads the file to the main Repository (does not let you choose the destination), which makes the non-encoded video to be available to the user.
Is there a way to override this behaviour without modifying the core files?
or is there a way to tell the repository not to show this files until they are encoded (like a visibility flag)?
or can I create a custom field type from a plugin?
You can create custom field type for your plugin. Just use Full class name including namespace in Grid configuration.
File input which save files to tmp folder would be useful for others. So you can contribute it to the core too.
Since it's possible to download Game Center metadata through Transporter into a .itmsp package file, how would you edit and upload that file using Application Loader? I see no interface for Game Center metadata in Application Loader. Application Loader is default app to open .itmsp packages. Did I miss something?
At worst best I guess it could be possible to edit the contained .xml file, add a few achievements, and then try to upload that into iTunes Connect using Application Loader.
If you make a lookup on an existing app inside your Itunes account, you download a file called like like the vendor_id with the .itmsp format. My experience was, opening this file by double clicking inside the Application Loaderjust changes the data inside this archive.
In my case, an additional file was created called something like meta-local... and the metadata.xml from Itunes Connect has been changed. It's like the Application Loader deletes information like description, keywords, url`s, screenshots and all the data you have to define the first time you create the app before uploading the binary.
Instead of using the Application Loader you should open the .itmsp file by right clicking and selecting show package content. This way nothing will be changed and you can open the metadata and change specific data.
I don't have Game Center elements included in my app yet but I did some researches on tools which could automate the process of generating and changing data. Have a look at these projects, the first one looks like it could be exactly what you're looking for:
iTunes Transporter Generator
iTunes Store Connector
iTunes Store Transporter Web
If not maybe you could create an Apple Script to parse the metadata.xml and add or change your data.
I would appreciate if you could leave a comment if any of these tools could help you with the Game Center problem.
I'm developing a simple web app and I just want to allow the user to upload some pictures.
should I just store the picture url on my database table or should I upload the whole picture?
how can I validate the size of the picture being uploaded?
how can I upload the picture from my controller?
thank you all!
I would NOT store the image data in the database. I would create a Behavior that will upload the image to the image directory and store a reference to that image. The behavior can then handle size, mime type, etc. Then add a file upload form to the controller and when the data goes to the model to be saved, it will automatically upload the image and put it where it goes.
If you do not want to build your own, here is a very popular behavior that someone has built.
https://github.com/jrbasso/MeioUpload
Or you could try this simple way of doing it (check the readme.md file) :
https://github.com/malikov/cakephp2.0-image-upload
How can we upload an image while registering the customer in zen-cart?
I would like to provide an option to upload the customer's image on registering with a zen-cart application. Is there a plug in for that?
Not that I've heard of. You would need to extend the customer_info table to hold the image file name, add an extra field to the account creation page and then handle the uploaded file in the account creation pages includes/modules/pages's header_php.php file.
However, there is a Zen Cart file upload class that provides an easy to use toolset for the last step. The admin banner page offers a good example to copy from.