I want to store my wordpress theme asset files or wordpress asset files into DigitalOcean Object Storage.
I have successfully implemented the system for wp-content/uploads files to store those library images into DigitalOcean Object Storage through a plugin.
Now, I just want to transfer my other css, js, images files into Object Storage and load them from the Object Storage link?
How Can I do that ?
As an example,
there are some files in wp-includes > css, js, images
Where are these files are used and how the links of these files are working?
Now How can I upload these files to my object storage and load from the object storage link? Is there any plugin out there? or Do I need to change anything manually ?
Related
I have a huge file stored in a s3 compatible cloud ocean (not Amazon). I want to have a download button which will result to downloading this file for user.
I have installed "Media Cloud" plugin which has ability to connect to s3 compatible cloud. But I cant find a way to serve this file which is only saved in my s3 bucket in my wordpress.
If you only have 1 file to serve, you should be able to get the URL of the file in your s3 bucket admin panel where the file lives.
The main thing you need to check if the object (the file) is publically readable and your bucket is set up as a "static website" so it can serve HTTP. If it's not, you won't be given an object URL to put on your site.
I'm not sure who you host your s3 with if you say it's not Amazon, but here's a guide on how to do it if you did use Amazon.
I want to retrieve access to a Google Analytics account. Google has advised me to create an analytics.txt file at the root of the website such that htttp://my-site.com/analytics.txt.
How do you manually place a .txt file at the root of a site using Gatsby? Gatsby compiles JS files into HTML. I've tried manually placing an analytics.txt file in the /public folder but that doesn't seem to have worked either.
The Gatsby documentation is not helpful on this topic.
We are deploying the site using Netlify and storing the source code on Git Lab.
Any help would be appreciated.
If you create in your root project a folder named static, it will compile with the same name and internal structure in the public folder, so you will be able to refer to those files and assets in your React components. You can check for further information in their docs.
However, in your case, you may want to use a Gatsby plugin to place your analytics code. Here's the documentation.
In the scenario you've described, your solution didn't work because the public folder is regenerated in each build/compilation of code so your .txt is deleted in each compilation.
My client is using an old media attachment URL for their email signature logotype. This image has now been removed and I would like to upload the same image again and place it in the same directory as before, recreating the URL.
However, when I upload a new media file to Wordpress, the file automatically is placed in a directory that corresponds with the current date: .../wp-content/uploads/2018/09. I would like to place it in the directories .../wp-content/uploads/2015/09/.
Is it safe to manually create these folders and upload the file via FTP or would the manually added files be overwritten or removed in some way upon updating Wordpress? If so, is there some other way to change the date of a media attachment and automatically create the correct folders depending on the date I change it to?
If there isn't a folder "2015" in your /wp-content/uploads you can add this folder through your FTP program, same goes for the monthly folder. If the folder for the year and/or month are already there you can just upload the image to the desired folder by using your FTP program.
I am using CDN for hosting all the images, I have a folder of sub-folders in which each sub folder has a different number of images. Given this situation, how do I actually grab the number of images in each folder in php script?
I am using codeiginter for this project.
Previously I was using this script as the images were not hosted on CDN yet.
count(glob('http://www.mywebsite.com/folders/sub-folder/*'));
Thanks in advance for any help!
You have directory helper in CI, thats read folder and put all in array, use it like this
$this->load->helper('directory');
$data['files']= directory_map('./folders/sub-folder');
And simple count array members in view
$number=count($files);
Or Just
echo count(directory_map('./folders/sub-folder'));
I have video files (mp4's as I want people to be able to view them on ipads etc.) that I serve to users. However some of these videos are only available to users who have a certain number of user points. I have that working in that if a user doesn't have enough user points they can't view the node. All users have the same role (video viewer) and the problem is that it is possible for someone who has enough user points to view the node, grab the url of the video and then give it to someone who has the video viewer role but doesn't have enough user points and then that person can directly download that mp4.
Just looking for a way to limit access to the mp4 file if a user does not have access to the node or hide the path to the file somehow. I have the mp4's stored in a private file system but this hasn't solved the problem as the users have the same role.
I've got this (http://www.ioncube.com/html_encoder.php) working on static pages in my webspace (non drupal pages) but can't get it working in my drupal setup. When I include the php code in my node to include the php file it just gives me a blank page.
Many thanks
There's not much I could say about this that the Drupal documentation doesn't already.
http://drupal.org/documentation/modules/file#access
Managing file locations and access
When you create a file field, you can specify the sub-directory of the site's file system where uploaded files for this content type will be stored. The site's file system paths are defined on the File system page (Administer > Configuration > Media: File system).
You can also specify whether files are stored in a public directory or in a private file storage area. Files in the public directory can be accessed directly through the web server; when public files are listed, direct links to the files are used and anyone who knows a file's URL can download the file. Files in the private directory are not accessible directly through the web server; when private files are listed, the links are Drupal path requests. This adds to server load and download time, since Drupal must resolve the path for each file download request, but allows for access restrictions.
The best practice for public files is to store them in the multi-site directory like: sites/default/files
The default way to securely add a private directory for your files is to use a directory that can not be accessed directly by your web server, but can be accessed by Drupal. Ideally this directory should be located outside of your Drupal root folder.
The simple way to add a private directory for your files is to create a sub-directory under the public directory like: sites/default/files/private
When you specify the private directory in admin/config/media/file-system it will automatically create the sub-directory & create a simple .htaccess file with Deny from all. This stops Apache from serving files from this directory. Make sure that you test this by adding file to that directory and verifying that you can't browse there directly. If this isn't working, all files in this directory will be accessible to anyone who can guess the URL! Note that non-Apache web servers may need additional configuration to secure private file directories.
Accessing Private Files
Once configured, files stored in the private directory are inaccessible via a direct link; however, if Drupal constructs a link to the file, the file will be accessible to anyone who can see the link.
For example: you have created a new content type with a file field which stores files in your site's private file directory. Next you create a node from this new content type and attach two new files. When the node is published links to both attached files are visible and anyone who can view the node may download the files. Now, if you unpublish the node, all attached files become inaccessible for download even if you use the direct link to the files that worked when the node was published.
Re-publish the node, and disable the "display" checkbox for one of the files. Save the node. Now one file is accessible for public download and the other is not accessible--even if you have the direct URL for the file that is not listed you will not be able to download this file.
For finer grained control of who can see/download attached files you will need an additional access control module. You may write a module yourself, or use a contributed module such as Content Access.