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
0 answers
14 views

Issues uploading and transforming images

I'm running into issues when uploading images, both locally (DDEV) and in staging environments. Attempting to upload images to staging gives a generic: Upload failed for “example-image.jpg" ...
Seth Warburton's user avatar
1 vote
1 answer
22 views

How to lowercase the value of a variable used as default upload folder for assets?

The entry variable stores values such as S001-LU, S009-SH, etc. I use this variable as default upload folder for assets. I would like to lowercase the value from the field, i.e. s001-lu, s009-sh, etc. ...
flip's user avatar
  • 105
1 vote
1 answer
16 views

How to delete asset folders in CraftCMS backend?

I created some asset folders which are displayed in the backend and which I would like to remove. I manually removed the directory on the server. It is still shown in the backend. The options in the ...
flip's user avatar
  • 105
0 votes
1 answer
32 views

Assets dynamic location functions of site

In Craft 4.7.2.1 Pro, I try to create dynamic path location for my assets for my field "image". The field image is in MySection, which is shared with multiple sites. I would like to organize ...
emilie zawadzki's user avatar
2 votes
1 answer
35 views

Saving metadata for asset when uploading file

I'm trying to set the value of a custom field for an asset while uploading the asset. But somehow the value is not being saved. I can see the data in the EVENT_BEFORE_SAVE and EVENT_AFTER_SAVE hook, ...
thomasjonas's user avatar
0 votes
0 answers
28 views

Frontend assets upload to folder (Craft 4)

I need to upload files into an asset folder I have created using a frontend form, however I can't seem to get this to work in Craft 4. This is the code I have used: <form method='post' accept-...
Branko's user avatar
  • 497
0 votes
1 answer
41 views

Ajax fileupload into asset folder (Craft 4)

I am upgrading a clients website from Craft 2 to Craft 4, and I'm stuck at ajax fileuploads to the CP. I'm using fileupload.js for this. In Craft 2 my code looked like this, and I'm struggling to ...
Branko's user avatar
  • 13
0 votes
0 answers
101 views

Amazon S3/Cloudfront bucket providing "Unable to check if <img> exists" error when uploading an asset

I have just set up my first S3/CloudFront service to handle assets and it all seems to be connected right, but when I upload an asset into the volume that is stored on S3, I get this odd error in ...
Jay's user avatar
  • 1,042
0 votes
0 answers
54 views

CRAFT_WEB_ROOT incorrect when trying to "Move Craft’s Files Below the Webroot"

I'm having trouble deploying a project: My web hoster automatically generates vhosts for each domain, with their respective webroot being /var/www/myuser/mydomain.com/; so I followed the Moving Craft’...
kindoflike's user avatar
1 vote
1 answer
87 views

Image path is broken after updating site from Craft version 3 to 4

I am currently in the process of upgrading my site from 3 to 4. My craft CMS version is 4.4.16.1 None of my images are loading in the site after performing update. Our images are stored in AWS. Upon ...
Sajjan Shrestha's user avatar
1 vote
2 answers
136 views

Uploading (multiple) assets to assets controller via front end with Craft 4

I'm trying to upload assets directly to a volume using the 'assets/upload' controller in a front-end form. There must have been some changes since Craft 3 and I'm running into 2 issues: Issue 1: ...
MetaMachine's user avatar
1 vote
2 answers
150 views

Adding an assets image URL field to an RSS feed

I am creating a RSS feed from a news channel and I have gotten it all working except for the news story image which is an assets field. I want to pass the url of the image so I can pull it in via feed ...
bhackett's user avatar
  • 127
1 vote
1 answer
77 views

Can't delete asset subfolder

I just created a subfolder to test how it works but now can't delete it. If I select it and then click the "options wheel" in the bottom, the delete button is disabled. Is there another way ...
obs's user avatar
  • 509
1 vote
1 answer
20 views

How is it possible to upload photo directly from mobile phone/webcam and link it to an entry?

I would like to take photos on a mobile phone/webcam and upload them automatically when the photo is taken. Currently, I'm taking photos have it saved on my local desktop and upload them manually to ...
Carl's user avatar
  • 11
1 vote
2 answers
93 views

GraphQL queries for srcset

I am trying to fetch srcset with GraphQL from Craft4 but I don't really understand the syntax. In my twig Templates I use image.getSrcset(['1x','2x'],'myTransformHandle') and I'm trying to translate ...
thomas's user avatar
  • 131
2 votes
1 answer
91 views

PDF with Content-disposition: inline; only works with devMode ON

This works fine with devMode(true), but not when false. I'm calling it as a craft variable {% do craft.mymodule.pdf(entry) %} public function pdf(Entry $entry) { $asset = $entry->asset->one()...
Leo Leoncio's user avatar
0 votes
0 answers
25 views

New install, re-indexed Amazon S3 folders, Craft not creating/finding transforms

Yesterday I re-indexed the contents of my image library on Amazon S3 to a fresh install. I can see the images in Assets, I can use the images in entries and then tags/templates, I can import entries ...
Emma Swann's user avatar
0 votes
0 answers
166 views

Error while trying to create Assets/Asset Volumes

If I try to create a asset field, a server error occurs when I select the Field type "Asset" and I can't edit it further. I also can't edit my Assets because when I click on it I get an ...
Lucas's user avatar
  • 1
1 vote
1 answer
26 views

Assets display changed, cutting off folders

I am not yet able to upgrade to Craft 4 due to some plugins used regularly not being ready, but on updating 3 to a newer version a few weeks ago, noticed the way asset folders were displayed - both on ...
Emma Swann's user avatar
1 vote
1 answer
47 views

How to get second asset in Craft CMS 4?

In craft cms 3 we could use this: {{ entry.images[1].url }} But how can I get second asset in Craft CMS 4?
Nikolay Bronskiy's user avatar
1 vote
2 answers
77 views

Showing related assets referred to within Redactor (rich text) fields

When an entry includes a reference to an asset, like an image, that information is tracked and displayed. (The included screenshot shows where that reference would be, although this particular entry ...
4midori's user avatar
  • 656
1 vote
2 answers
248 views

Asset Indexing is frozen and I can't discard the task

I'm using Craft 4.3.6.1 and a DigitalOcean Spaces filesystem. On the Utilities > Asset Indexes page, I clicked "Update Asset Indexes" button. A procress started and got about 3% done ...
sea_monster's user avatar
1 vote
3 answers
403 views

Change asset title and filename on upload

I'm trying to rename files uploaded by users on the frontend. Changing the title is working, but I can't rename the file. Would appreciate some help! Event::on( Asset::class,Asset::...
supazu's user avatar
  • 526
1 vote
1 answer
228 views

Prepopulating image fields - Formie Plugin on Craft 4

I have a front end entry form for users to update their entry. It's built using the Formie plugin. I need the fields to prepopulate with the current entry content. According to the Formie docs fields ...
George Bleasdale's user avatar
1 vote
1 answer
131 views

How to get list of pages where the asset is used?

I have a list of assets link with assets id. eg: 23453 => 'https://some_cool_domain/assets/file_name.jpg' I need to find all the pages where this asset is being used. I am new to craftcms. I tried ...
Suman Bhandari's user avatar
1 vote
1 answer
176 views

Retrieve storage path of image transform instead of URL

I'm generating base64 encoded strings of very small image transforms to display a blurred version of images while the bigger asset is loading. I'm trying to get the cached transform path (if it ...
Capsule's user avatar
  • 131
1 vote
1 answer
58 views

Detect on which entry / entries an asset is inserted

Is it possible to display in the asset overview on which entry / entries an asset is used? So that when I go into an asset, I have an overview of the entries where that asset is inserted.
ChuckLean's user avatar
1 vote
1 answer
107 views

Set asset volume dynamically via module depending on uploaded file kind

I'm trying to set the asset volume dynamically for new assets, using a module. I would like the volume to be based on the asset's file kind – in my case, automatically putting MP4s into a 'Videos' ...
Josh Harrison's user avatar
0 votes
0 answers
56 views

AWS Load Balancer - Assets Uploads

We have two ec2 instances and a private IP db instance along with a Amazon Load Balancer. Is there a way to upload images on CraftCMS domain pointing to a load balancer? Right now the assets image ...
Noor M's user avatar
  • 1
0 votes
1 answer
51 views

How to enforce subfolder names for uploaded assets in hierarchical related sections

My goal is to ensure uploaded videos are organized into folders like: /Show/Season/Episode/videofile.mp4 Or stated another way... /{{ Show ID of grandparent }}/{{ Season ID of parent }}/{{ Episode ...
Jim's user avatar
  • 139
1 vote
1 answer
184 views

How to rename an asset on file upload Craft 4

I am looking to update some custom module code which updates the file name on upload. In Craft 3 I had this working by listening to the EVENT_AFTER_SAVE on an Asset. It would detect the ID of the ...
zizther's user avatar
  • 449
1 vote
2 answers
210 views

Is there a way to block access to assets by url?

This will probably not be possible, but here goes nothing: I have entries that are password protected using the Template Guard plugin. While this does work perfectly, this does only password protect ...
fr-haus's user avatar
  • 58
0 votes
2 answers
330 views

Get Entry Slug from specific Locale

I have a multilingual entry setup using different sites for each language. I want my assets sorted by slug, but since the slugs are different in each language, all assets are saved three times. My ...
Sandro's user avatar
  • 43
0 votes
1 answer
91 views

Multiple image are automatically created?

I am using Craft 4 and I noticed after uploading an asset, additional folders are created automatically with multiple sized versions of the same image I uploaded. This causes a lot of additional files ...
Darthrizen's user avatar
1 vote
1 answer
55 views

Craft changing/corrupting assets on download?

I have a problem with downloading files from Craft CMS using the "download asset" action on the asset page in the control panel. These files don't have a public URL and needs to be ...
Slebbo's user avatar
  • 87
0 votes
0 answers
45 views

Query multiple users and inner join to assets field

How to query multiple users and join to assets field? I want to query users with IDs [1,3,4] and inner join it to assets field with volumeId 5 and titles [1,3,4]. Tried this but this is probably wrong ...
tenshi's user avatar
  • 101
0 votes
1 answer
107 views

Transformed JPGs have larger file size than original

Question Why is it that sometimes a transformed JPG is larger than its original when it is transformed using Craft image transforms even though in my general.php file I set upscaleImages to false? ...
fr-haus's user avatar
  • 58
1 vote
1 answer
52 views

Craft 2 Looping Through Assets Limit 100

In Craft 2, I am looping through Image Assets, but the loop stops after 100 images. I currently have around 140 images, but only the first 100 appear. Is this a built in limit in Craft 2? Thanks {% ...
buck1112's user avatar
  • 400
1 vote
1 answer
1k views

Craft4 stream_copy_to_stream(): Argument #2 ($to) must be of type resource, bool given

As mentioned in the title, I'm not able to upload any files in Craft4. I created a filesystem and a volume which is connected to the filesystem. In the assets-field settings I added the volume. I have ...
mcoze's user avatar
  • 41
1 vote
1 answer
191 views

Hosting and permission problems

It's my first time deploying CraftCMS and I ran into some issues which I don't seem to fix. I'm using Combell to host my website. I can only access my site when I go to "sitename".be/web/ . ...
Knz-dw's user avatar
  • 11
1 vote
1 answer
632 views

Why am I getting, 'Unable to write stream to' error when uploading asset?

I set up Fortrabbit object storage but when I go to upload an image in 'add asset' I get this error in a pop up; Unable to write stream to 'fileName' When I try to upload it with 'upload asset' the ...
Zack Reid's user avatar
1 vote
1 answer
241 views

How do you upload an asset via an API or GraphQL

Is it possible to upload a new asset via some POST request to craft's API? Or maybe through a graphql mutation? I noticed in the public schema there is the option for Creating assets within a volume. ...
nikolaj frey's user avatar
1 vote
1 answer
348 views

What's the correct way to check that an asset file exists?

If I have an asset resource, loaded successfully from the database, whose corresponding file no longer exists on its Volume (irrespective of Volume type), what is the best way to find out if the file ...
tomkiss's user avatar
  • 43
1 vote
1 answer
466 views

Creating an asset from an API using a module

I'm currently making a module that I'm hoping is going to create entries and assets from an API. I've got the entries part working and now I'm trying to create an asset from a URI of an image. I've ...
Jack Nixon's user avatar
1 vote
1 answer
41 views

How can I use a transform on images in a body field that have been imported?

I have imported content into an old news entrytype for a news channel. The odd image in the body field is 4000px wide. Is there a way of automatically transforming these in a template or from the CLI? ...
joomkit's user avatar
  • 2,014
3 votes
1 answer
555 views

Eager loading categories and assets inside related entries for gallery

I am looking for some advice on how to best streamline a gallery system on a site, but having trouble wrapping my head around the syntax needed to eager load nested asset fields with categories inside ...
sonoflee's user avatar
1 vote
1 answer
19 views

Asset has a child category but only displays the parent on templates

I have an asset volume that has a category field. The category field has no max level so I can have parent/child categories. If I set a child category to the asset in /admin then all is well, but when ...
Jaytrix's user avatar
  • 187
0 votes
0 answers
224 views

Upgrading Craft (and docker image) now causes SIGSEGV core dumps and problems with mutex locks

I just upgraded to 3.7.27.2 (as an intermediate step) and since I'm always deploying with the latest docker image (craftcms/nginx:7.4) I have also gotten the latest expat upgrade. I'm not sure where ...
jishi's user avatar
  • 263
0 votes
0 answers
98 views

How to save the selected assets in custom module

I am trying to create a custom module where I have created an asset uploader field. Images are getting uploaded with that field but not saved. class Settings extends Model { // Public Properties ...
Eira's user avatar
  • 1
1 vote
1 answer
668 views

Get the width and height of videos

I need to get the width and height of videos to calculate some aspect ratio. Craft doesn't do this out of the box. Any plugins that does this? Or can i write my own?
J. Sveum's user avatar

1
2 3 4 5
18