Questions tagged [assets]

Files managed by Craft, stored in physical folders or (with Craft Pro) on Amazon S3, Rackspace Cloud, and Google Cloud.

Filter by
Sorted by
Tagged with
0
votes
1answer
19 views

How to upload animated webp files?

I've created an asset volume to which I can successfully upload jpgs, pngs, static webps etc. But when I try to upload an animated webp I get the alert: Upload failed. The error message was: “The file ...
1
vote
1answer
29 views

Search for assets containing a custom field

How can I search for assets containing a custom field? The field on the asset is called lang. When I use this code no assets are found. {% set folderId = craft.app.request.getQueryParam('folderId') %} ...
0
votes
0answers
12 views

When Asset is Located in Root of Asset Volume - asset.getPath() Does Not Return the Volume as Part of the File Path

Context Asset Volume: staff (I'm using an S3 bucket as the source type) Image location: staff/john-smith.jpg Version: Craft 2.7.8 Results I expected that this query {{ staff.portrait[0].getPath() }} ...
1
vote
1answer
28 views

How would I detect whether an entry's asset field has been updated on save?

We need to send a notification email when an entry's asset field, Custom Image, has been updated on entry save. We're able to do this consistently for text fields but I'm having trouble doing the same ...
1
vote
1answer
32 views

Serve remote files instead of local ones (with a nitro setup)

I'm new to CraftCMS and slowly learning how to use it. I'm creating a site. The local setup was done with Nitro. I have read about the ways to synchronize data and assets across environments. But I ...
0
votes
0answers
21 views

Image thumnail not found(404) issue. What causes the header to set as image/svg+xml instead of png/jpeg?

Thumbnails not loading in assets list in my control panel with my host platform.sh(works in my local docker env). Call to index.php?p=admin/actions/assets/thumb&uid=29dad26b-ba90-4b26-b9fb-...
2
votes
1answer
34 views

Showing and playing video's in Twig templates

I want to be able to upload and play videos on my Craft CMS website. I created a volume and field to hold these videos. So far so good, but whenever I want to output the video in a video tag I'm not ...
1
vote
0answers
25 views

Is there a way to prompt for confirmation in cp?

I have a custom plugin that checks for assets filename, and I'd like to prompt for confirmation like in the example below. Is there a way to do that in Cp? If user clicks No then $event->isValid = ...
3
votes
1answer
30 views

How to fetch all assets that are in use, via a specific field

We have a channel of entries which all include the same asset field. We are trying to fetch all assets that are actively in use, ergo the assets which have been linked to any of the entries in the ...
1
vote
0answers
28 views

Changing assets location in entries after moving them to a different volume

I've moved all the assets from a local volume to a DigitalOcean space (S3 compatible) and all new entries are using that volume. I've updated all assets fields to use that new location. My problem is ...
2
votes
1answer
24 views

Getting assets from an entry programatically

I want to get the id of an asset I've set for a feature image on an entry. To find the entry I'm using the slug as the criteria like so: $entry = Entry::find() ->slug('0002') ->one(); In ...
2
votes
1answer
33 views

Assets S3 Cache Duration and CP Thumbnails

What does everyone consider a sensible cache duration to use when using Assets with S3/Cloudfront? Is 3 hours sensible or should it be longer? Secondly, does this have any impact on the assets being ...
1
vote
1answer
45 views

Craft CMS - 3.6.11.1 - Why are Assets Backed Up to Temporary Storage?

Since updating Craft CMS to the latest version I noticed that our uploaded files get backed-up daily to temporary storage. Uploaded files live on DigitalOcean Spaces so we have no need to back up ...
1
vote
1answer
22 views

Craft adds unwanted date to filename

How to remove the date behind a asset filename or prevent add a date behind the filename? I'll have a plugin that's modifies an existing pdf with SETA SIGN. To do so I'm copy the current asset, modify ...
1
vote
1answer
47 views

Importing data from an old EE site

I've been asked to export some data from an old EEv2 site into a Craft site. I thought I should be able to export the data from EE into CSV or XML and then use FeedMe to import it. But one of the ...
1
vote
1answer
26 views

Upload file issue on Craft 2.9.2

This issue is occurring on Craft 2.9.2. The assets are stored on Amazon AWS (S3). When I try to uploaded a new asset (of any size, even very small), the progress bar moves to 100% position but remains ...
0
votes
0answers
14 views

Can't delete sub folders

I have an issue where I cannot permanently delete a sub-folder from the "Assets" section in the control panel. When I delete the sub-folder, it does delete, however after logging out or a ...
1
vote
1answer
17 views

How to hide the assets section of the control panel to specific user groups?

I need to hide the assets section of the control panel to a given user group. Changing the group permissions to prevent them from viewing all asset volumes also prevents them from uploading assets in ...
1
vote
1answer
40 views

How do you insert the site name into a default asset path?

Multisite question.... how do I output the site into the assets path? currentSite won't work because its the admin panel, so the current site is always the default site. Using the below, I will always ...
1
vote
1answer
29 views

Get image asset relative url

I'm using image transforms and getUrl() method to display an image. I'm using Blitz to export my site as a static website. My problem is that .html pages get cached with images that have full urls ...
0
votes
0answers
45 views

Trouble generating correct srcset sizes using getSrcset()

I'm trying to figure out the getSrcset() method, going by the docs here. When I try it using the code in that example (I modified to account for a Matrix field but other than that it is the code below)...
2
votes
1answer
21 views

Deleting one or all Assets from a fieldusing a front end form

Good afternoon All, Im trying to setup the ability for users to delete 1 or more of their own images from a multi photo asset field and have got stuck. This is what is have so far, I assumed adding a ...
1
vote
1answer
25 views

Display list of assets that are in use?

I am very new to Craft and how it works. I've got a client with a Craft site (v2.9.2), that I help them with. It was created by another developer. I want to help them tidy up their Assets. There are ...
0
votes
0answers
9 views

How to empty the Temporary Uploads folder and why can individual users not delete files within up this folder?

I am perhaps over looking something, but I cannot see anyway for an back-end user (not admin) to be able to remove/clean up their Temporary Uploads folder. As a full admin, I see the option to remove ...
1
vote
1answer
21 views

Does deleting an original asset but keeping the transform folder asset make Craft replace the original file with the biggest transform?

I have a client who has uploaded many giant images to the CMS (8mb+). I'd like to free up that space now that those image have been transformed to more web-friendly sizes. Is it safe for me to delete ...
0
votes
0answers
8 views

Updating uploaded assets directory structure

How can i update uploaded assets directory structure, when i change assets field "Default Asset Location" settings - so files match this new setting? I have so much files all in one ...
0
votes
0answers
27 views

What’s the pattern for Entry Form inputs for Assets meta data fields?

The templating pattern for Entry Form inputs for Assets files is clear enough. But how can I provide inputs in an Entry Form for meta data pertaining to an Assets file? For example, I have fields like:...
1
vote
2answers
49 views

How to Get Asset Volume Name

Trying to figure out how to get the "name" and "handle" of an asset volume, given the volume ID. Tried all the obvious things, no luck!
1
vote
1answer
39 views

Create folder in asset volume via GraphQL

Is it possible to create a subfolder within an asset volume via GraphQL? If yes, can you point me in the right direction? I just found mutations for file uploading, but nothing for folder creation. ...
0
votes
0answers
19 views

Migrating assets from remote volume (Cloudinary) to local folder

I need to migrate an asset volume from Cloudinary to local folder. What is the appropriate strategy to execute the change while maintaining database integrity? Can I simply change the volume type to ...
2
votes
1answer
57 views

How to detect white background

In my product catalog, some product images need to have the css attribute object-fit: cover while some need the object-fit: contain: I'd like to detect the white background, possibly on upload (to ...
1
vote
1answer
41 views

Viewing Assets (PDFs) associated with an entry directly from that entry screen

I have a channel with an Assets field, designed to hold PDF files. It works fine to select one or more files, and/or upload files and select them. However, I'm wondering if there is a way to view a ...
0
votes
0answers
12 views

Can't list S3 buckets from Craft behind a firewall

We are using Craft2, and want to move the assets to Amazon AWS S3. We have two instances of Craft2, one on AWS, and one on a onprem server. The bucket is made (and is on eu-west-1) and the IAM user ...
0
votes
0answers
14 views

Entry ancestors is null in dynamic asset subfolder path or during EVENT_AFTER_SAVE event

I'd like to use the slug of the top-level entry in a structure in an asset's dynamic folder subpath. I have a structure where the entry I'm concerned with for this question can sit at either the ...
1
vote
2answers
85 views

Video Asset URLs not rendering

I'm trying to output the video files from within a block but get a Calling unknown method: craft\elements\db\AssetQuery::url() error when using the following: {{ block.video.videoFileWebm.url }} ...
1
vote
1answer
27 views

Loading assets cross-domain with SSL or non-SSL option

Here's a unique situation. I have three websites. All assets are stored at the domain of the first site: domain.com/files/* The first two sites run completely over SSL. No problem. The third site ...
2
votes
2answers
46 views

Enironment Variable being rendered literal

OK, So created 2 variables in my local .env file ASSET_BASE_URL="https://mysite.local/resources" ASSET_BASE_PATH="/Volumes/yada/yada/yada/resources" Then in the CP, created a new ...
0
votes
0answers
15 views

Event or hook to access when needing to show session messages via AJAX within Asset Events in the control panel

I am using EVENT_BEFORE_HANDLE_FILE on the asset class to moderate images before they are uploaded. I am setting session errors which show fine on the frontend templates on page refresh, however in ...
0
votes
0answers
128 views

Path to asset file shows “Template not found!”

I have a headless Craft CMS site and now the frontend development should start. I have absolutely no frontend or templates as I only worked on the backend. The asset url got created at /images. If for ...
0
votes
0answers
58 views

AWS S3 permissions issues with referrer conditions

I've got an odd situation happening with assets stored on AWS S3, which I'd appreciate some help understanding and resolving. Background Software Version: Craft CMS v2.9.1 All S3 assets were recently ...
1
vote
1answer
36 views

Set asset uploader from frontend entry form

Now that Craft keeps track of which user uploaded an asset, I'm wondering if it's possible to set this information when an asset is uploaded via a frontend entry form. I have a form that includes an ...
0
votes
0answers
26 views

Form field as 'Upload Location Subfolder'

Question concerning the Freeform plugin: Is it possible to set the contents of a text field as my 'Upload Location Subfolder' of a file upload field? I tried stuff like {{ form.customerName }} and {{ ...
0
votes
0answers
35 views

How can I get the dimensions of a video asset?

The video itself hasn't any dimensions (width and height) within its object. But Craft saves a thumbnail, right? How would I get to the thumbnail to get its width and height? Or is there something ...
3
votes
1answer
55 views

Only allow SVG as file type

I want to have an asset field which only allows .svgs. To be more specific, I want to upload icons I can later import in my templates via the svg() command. Is this possible without any plugins or a ...
1
vote
1answer
21 views

CP assets uploads are reverse ordered after upload

Problem CP assets uploads are reverse ordered after upload. Description I have a folder with 5 images: 1.jpg 2.jpg 3.jpg 4.jpg 5.jpg I want to upload these images in the Craft CP. I have an Asset ...
1
vote
1answer
32 views

Where does Craft store HTML Templates?

I have recently been given access to a Craft site's control panel. I need to edit the homepage to add data in the footer. As I didn't create the Craft website, how can I access the HTML I need to add ...
1
vote
1answer
46 views

How can I change the Date Created for Assets?

I'm using graphql to pull in some assets/pdfs and ordering them by dateCreated, however the files go back a few years (i.e. files from 2019, files from 2018 etc.) but they weren't uploaded in the ...
1
vote
2answers
40 views

How to upload asset element on its own, not into an asset field (frontend form)

I have read this resource about uploading a file to an asset field on an entry, but I believe I need to create the asset on its own because the asset has 2 custom fields associated with it that I want ...
2
votes
1answer
131 views

Protecting public assets

I'd like to manage access to assets with public URLs. Is there a way to set permissions for anonymous users?
0
votes
0answers
83 views

What's the recommended permissions configuration for AWS S3 media storage?

I'm hosting assets for Craft 2.9.3 site on AWS S3. I'm trying to figure out how to give the site (and its users) access to the files without making them broadly publicly available. I found a ...

1
2 3 4 5
16