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
24
votes
3answers
6k views

How can I automatically generate responsive images from a single hi-res asset?

I want to be able to upload a single high resolution image, and output a <picture> element that outputs it with a few different sizes and resolutions automatically (using Picturefill to sort out ...
20
votes
3answers
406k views

413 “Request Entity Too Large” error with uploading a file

In assets when uploading a medium size file I get this error: Failed to load resource: the server responded with a status of 413 (Request Entity Too Large) What does it mean? And how to fix?
18
votes
3answers
3k views

Allow user to change or delete their photo for their profile from the front end

How can I allow a user to change or delete their photo for their profile from the front end? I currently have a form setup for the user to edit their profile but I want to load their current photo (...
17
votes
3answers
3k views

What are the advantages/disadvantages of the various cloud storage solutions for assets?

When setting up a new assets source, Craft allows you to natively connect to one of these cloud storage solutions (assuming you're using the Craft Pro edition): Amazon S3 Google Cloud Storage ...
17
votes
2answers
3k views

How do I force Craft to regenerate assets transform?

I had to add an image size in the assets transforms; all my pics were previously uploaded, but when I use getUrl('headIpad'), it makes urls like this: http://host.com/cpresources/transforms/4/ ...
15
votes
3answers
3k views

How to get absolute path to asset file?

I have some csv files uploaded as assets and now I need to fopen() them from my plugin. I have an AssetFileModel but I have not been able to work out how to construct a full path to the file. I can ...
13
votes
6answers
11k views

When uploading assets what determines the maximum file size?

When I upload an asset I get an alert window stating my file size is to large. I have increased the file size in the general.php config file larger than the file size, however I keep getting a error. ...
13
votes
5answers
6k views

Image transforms returning cpresources url

I'm trying to get Craft to render an image transform defined in the control panel. No image is added to the "filelocation/_transformhandle" folder and returns the url "/cpresources/transforms/98" ...
13
votes
2answers
2k views

Is it possible to move an entire asset source?

S3 is seemingly costing us a lot. While it has its benefits, I think we could do with moving images from s3 to the server we are running the site from. How difficult/impossible of a task would that be?...
13
votes
2answers
2k views

How do we create a pre-defined Asset upload field in a plugin that integrates with the native Craft Assets file manager?

We've got a plugin. It doesn't have the ability to add custom field types. We're pre-defining all of the fields. One of the fields needs to be an Asset field. A user should be able to upload an ...
11
votes
3answers
3k views

Is there a way to force Assets to redo transforms?

Client has uploaded a number of severely badly lighted photographs for a 'staff' section of a site and these all have had a 'staffThumb' transform applied to it on the sites pages. I corrected the ...
10
votes
2answers
3k views

Correct IAM settings for Amazon S3 bucket

I'm trying to setup an Asset source on S3, but i'm having trouble getting the correct permissions. This is my current policy file: { "Version": "2012-10-17", "Statement": [ { ...
10
votes
1answer
3k views

How can I access the file extension of an asset?

Migrated from a Slack #help channel question Jason Mayo [09:53 16/6/15] Is there anyway to output what file type an assets file is? E.g. if its a Jpeg, SVG or Gif etc.
10
votes
2answers
2k views

How to add more options to the 'Restrict allowed file types' settings?

I am wondering what would be the best approach to add another file type to the 'Restrict allowed file types' asset field settings? For our website specification we need to have .zip files and .pdf ...
10
votes
3answers
1k views

Prevent Asset Transforms from scaling Image past 100%

There is almost never a reason why I would want an image to be scaled past 100% by a transform. This usually results in an image being looking worse than it would if scaled by the browser. Is there a ...
10
votes
1answer
2k views

Errors occuring with Assets and Amazon S3

I've just set up a new S3 account and want to move my assets folders there. But when I try to upload a file, I get the following error: S3::getObjectInfo(mikkelbang, shallowtree.png): [400] ...
10
votes
1answer
2k views

How do you delete assets from a frontend form?

I am creating a proof of concept for a client in Craft where the client's customers can manage projects from the frontend of a Craft install. I have a frontend form working correctly for creating a ...
10
votes
2answers
911 views

Update Asset Index in Batches

I have 80,000+ files on S3 that need to be added to Craft. The Update Asset Indexes works, but takes over 24 hours and cannot be interrupted. Does anybody have a way to programmatically index assets ...
9
votes
3answers
6k views

Can I output SVG code from an asset?

Is there any way to output the actual source code from an SVG asset in Craft? Rather than linking to it, I would like to embed the code in the page. I tried a twig include, but I cannot include ...
9
votes
4answers
526 views

What are the Pros and Cons to each image transform technique?

In Craft you can do two types of image transforms: 1. Control Panel Transforms: Via: Settings → Assets → Image Transforms 2. Inline Transforms in your Templates I’m currently using 100% inline ...
9
votes
2answers
5k views

Looping through images in a Asset field type

Sorry, this is kind of a newbie question, but I can't figure out how to loop trough all images in one image asset field supporting multiple images. The only way I have been able to output anything ...
9
votes
2answers
912 views

Is it possible to replace uploaded assets?

I have a site that uses several PDF forms that update from time to time. Instead of adding a new asset, I would rather replace the existing one. I couldn't see how to do that from within the Craft ...
9
votes
1answer
666 views

Is there a way to find out if images (assets) are landscape or portrait?

In a current project we will list entries in a masonry-style grid view where the entry’s respective cover image should be styled differently based on their image format. Landscape vs. portrait and -- ...
9
votes
2answers
8k views

Is it possible to clear caches and re-index assets programattically?

When migrating a Craft site, I'm used to... deploying files checking my config, tweaking as necessary loading a database backup running "Update Asset Indexes" and "Clear Caches" from the control ...
9
votes
1answer
1k views

Can I accept file uploads using the Craft Guest Entries plugin?

Can I accept file uploads using the Craft Guest Entries plugin? Using input type="file" doesn't seem to be working.
9
votes
1answer
923 views

How do I save a Matrix field with an asset block programmatically? [closed]

I'm trying to submit an Entry programmatically from the front end. Everything works flawlessly, except, the asset fields never save. I've dug and dug through the Entries, Elements, and Content ...
9
votes
0answers
782 views

How do I upload images programmatically?

I'm working on a plugin that creates auto crops of a selected image, but I am unsure of the proper steps to create and upload an image programatically. I am hoping that Local asset sources and Remote ...
8
votes
1answer
11k views

Fetch Image URL from entry CMS

This seems like it should be really simple. I set the field for an image asset, linked it to the entry type I want it associated to, and then uploaded the image in the cms to the folder I specified. ...
8
votes
1answer
3k views

GIF Animations NOT Appearing

I having a problem when trying to upload gif animations. It seems that the animation element doesn't work after they have been uploaded. I looked at the Craft changelog and it mentioned something ...
8
votes
1answer
656 views

Is it possible to hook into image transforms?

I have a somewhat unique thumbnail need for a certain site. I need to watermark images with custom text (per image, not globally across the site). Is there a way to hook into the Craft image transform ...
7
votes
7answers
2k views

Is there an easy way to download the assets directory to a local install?

I'm trying to speed up the process of synchronizing my production site down to my local install. Currently, it is: Back up database, wipe local database, import database backup. It's not perfect, but ...
7
votes
2answers
4k views

Frontend upload for images, mp3s and video?

I would like to allow users of our site to be able to upload images, mp3's and video from the front-end. Can I do this with the entry form template easily enough? I was thinking maybe I could use ...
7
votes
1answer
1k views

Image transforms getting applied even when image is smaller than the transform's width

I have a detail transform setup and here's my template code: {% if block.type == 'image' %} {% for asset in block.image %} <img src="{{ asset.url('detail') }}" alt="{{ asset.title }}" ...
7
votes
3answers
2k views

Dealing with missing images

How Craft reacts to missing images is one of the very few places where I find Craft less than ideal. TL:DR; Is there a way to make missing images not become a fatal error? How do you find elements ...
7
votes
1answer
3k views

How can I set dynamic absolute Asset URLs?

I'm working on my first subfolder-based Craft site, so I'm relying on Asset URLs based on the {{ siteUrl }} variable. I cannot, however, manage to get them working. Any tags I add to the URL field in ...
7
votes
1answer
330 views

Is it possible to use the assets modal on the front end?

Part 3 of a 3 part question: I am creating a proof of concept for a client in Craft where the client's customers can manage projects from the frontend of a Craft install. A missing piece to the ...
6
votes
4answers
4k views

All images uploading… except JPG files

No idea why but my local install of CraftCMS (in a MAMP environment) won't let me upload JPGs. PNG, GIF, even TIFF works (just for the heck of it). When I select the file in the browser dialog, it ...
6
votes
2answers
3k views

Does anyone have a working example of frontend form with multiple file upload, drag & drop etc?

I'm trying to create a frontend entry form for a logged in user, with a field to upload multiple assets to that entry. I've tried using the Jquery FileUpload plugin, but can't seem to get that working....
6
votes
1answer
4k views

Image asset url is not being output

After going through the documentation I believe that this is the correct code to output the url for the asset field but its not working and I have no idea why. Please help! {% nav program in craft....
6
votes
1answer
3k views

How can I link to an Asset from the Rich Text editor?

I have some content on my entry like this: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus quis rutrum dolor. I know I can link to an Entry or Category, but I would like to link to ...
6
votes
3answers
578 views

Extending Assets with oEmbed video references

Disclaimer: I'm new to Craft, making the jump from WordPress and looking for implementation advice to a specific requirement. In addition to images, I would like to be able to manage oEmbed video ...
6
votes
1answer
9k views

How to get asset URL from field in template

I'm new to Craft and having a very hard time calling the URL from a field I created called imagePrimary I've read this extensively but still no luck. https://craftcms.com/docs/assets-fields {% ...
6
votes
3answers
807 views

How do you require specific dimensions when uploading an image?

I think the transform feature is great, although in my case I need to request that certain images be uploaded at specific dimensions to an assets field. (i.e. 500 x 300 pixels). These dimensions will ...
6
votes
1answer
593 views

Cache/ColdCache & checking for ungenerated image transforms

This issue is very similar to the following issue, but this goes a little bit further. Cache tag won’t cache in a template I have a page which is made up of hundreds of lazy loaded images similarly ...
6
votes
1answer
4k views

Getting a “500 Internal Server Error” when uploading an image asset

Just giving Craft CMS a test drive. Setup a local site using MAMP Pro. Got the basic site up and running ok, admin as well. Then i wanted to try out image assets, so I created an Asset Source for ...
6
votes
1answer
1k views

How to fix “ambiguous” column error generated when DeleteStaleTemplateCaches is run?

Following up on: Deleting Stale Template Caches Failed Here's what I'm assuming is the tag throwing the error in the DeleteStaleTemplateCaches task. How would I disambiguate this? I'm not sure ...
6
votes
1answer
692 views

Are private S3 assets possible?

Is it possible to have an asset source pointing to a non public S3 bucket? Maybe also with expiring link urls?
6
votes
2answers
1k views

How to set up Craft to use Google Cloud Storage?

I've been clattering around the google developers console for a while, and i just can't get it to work with Craft! I figured it'd be simple (and it may well be!) considering in Craft it just asks for ...
6
votes
1answer
571 views

Asset thumbnail size in Entries

Is there a quick an easy way to change the asset thumbnail size when it's attached to an entry? By default this is quite small and restrictive and would like to show a more representative version of ...
6
votes
2answers
901 views

How to setup assets in multi site where each site should have its own assets?

I have a setup with multi sites that are separate domains. site-a.com site-b.com I would also like to have assets separate for each site, like so: site-a.com/images/picture1.jpg site-b.com/...

1
2 3 4 5
16