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
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?...
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 ...
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....
5
votes
1answer
1k views

How can I create an ElementCriteriaModel with 'and' and 'or'

In my template, I want to: Get all the entries in the section 'uploads'; Get all the assets that are related to one of the upload entries, and have a relation to all the tags I provide. So, that ...
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 ...
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 (...
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 ...
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 ...
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 ...
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. ...
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....
5
votes
1answer
1k views

How do I display a list of assets with the entries they are related to?

Given a list of assets, for each asset, how do I display a list of entries that relate to this asset? So, for instance, if asset A is selected as asset in entries 1 and 2, I want a list to be ...
1
vote
1answer
731 views

Change asset name on upload

public function init() { craft()->on('assets.onBeforeSaveAsset', function(Event $event) { $asset = $event->params['asset']; $asset->setAttribute('filename', 'new name'); ...
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 ...
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 ...
2
votes
2answers
2k views

Using image transforms sometimes results in bloated file sizes.

I'm in the process of setting up Asset image transforms for my site and was playing with the quality setting to find the right balance between file size vs. output image quality. As part of the ...
4
votes
1answer
2k views

How to upload an asset from a front-end form

I've found information on how to upload an asset as part of creating an entry. What I am trying to do is upload an asset from the frontend without creating an entry. I have a logged in user, and what ...
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 ...
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
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 ...
2
votes
1answer
1k views

How do I pull related entries and assets?

I'm having a bit of a hard time wrapping my head around exactly how to work with both Relationships and Assets. Here is my current problem that I seem to be stumped on, i'm sure once I get this going ...
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 ...
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.
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/...
5
votes
2answers
303 views

Transform different image if specific id or order

I have a masonry type image grid layout and I need to specify a different image transform for just the 2nd and fourth images in this grid. Does the image ID relate to the order or to the specific ...
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] ...
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 ...
5
votes
3answers
2k views

Is it possible to have secure (private) assets?

For a member only area I would like to secure (private) assets: The files should not be accessible when not logged in The file download URL should be randomly generated and should expire after some ...
4
votes
1answer
1k views

The file does not appear to be an image. Bug?

I've installed the latest ImageMagick on my ubuntu 14 server. If I force imageDriver to use 'imagick', I can only upload Gif images. And if I force it to use GD, I can upload all images but only ...
3
votes
1answer
1k views

Can I move a local Asset to S3 and keep relations?

I have a Assets folder (local) with 100 assets in it. Now I have a new Assets folder connected to Amazon s3. Can I just drag-n-drop my assets from my local folder over to my s3 folder and keep all ...
3
votes
2answers
2k views

Assets Folder: Images don't show up

I have an Asset Source, called files, with two subfolders: group1 group2 I also have two User Groups, with the same names. I want everyone in “group1” to save images into files/group1; and I want ...
2
votes
1answer
219 views

Best way to access getPrev and getNext asset fields

I am trying to access the previous and the next blog entries from my current post. Here is what I am doing {% set params = craft.entries.section('blog').order('postDate asc') %} {% set prevEntry ...
2
votes
2answers
838 views

Add an assets field to a field type plugin template

I have a plugin that creates custom field types to extend crafts default field types. The custom field types hold several different form input fields. For example the field may be called video and ...
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/ ...
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 -- ...
5
votes
1answer
3k views

Create entry with newly-uploaded asset programatically

I'm trying to do something very simple - but I've yet to find documentation to cover this basic scenario. I'm writing a plugin. In a controller, I want to create a new entry, and assign an uploaded ...
4
votes
2answers
240 views

Using Image Transform as another custom field

I've created a section with a thumbnail image and also a dropdown to allow the user to select the transformation to apply to that image. I've pre-created all the asset transformations ready and this ...
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 }}" ...
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 ...
5
votes
1answer
354 views

How do I allow a user to remove an uploaded asset from a front-end entry form?

I see for users, I can add a hidden field <input type="hidden" name="deleteUserPhoto" value="1" /> to remove the uploaded photo, however I need to allow this functionality for an assets field in ...
3
votes
1answer
813 views

Search across Entries and Assets and paginate combined results

I need to search both entries and assets and paginate the combined result. I have tried: {% set entries = craft.entries.search(query|trim).order('score').status('pending, live').find() %} {% set ...
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 ...
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 ...
3
votes
1answer
633 views

How to upload assets without user interaction?

Context: we sell some magazines and other newspapers on our site, and updating all the cover images manually is a hassle. I would like the ability to write a url in a field (www.myimageprovider.com/...
1
vote
1answer
753 views

Do Remote Assets (ie. S3) have file paths?

New to remote assets, and can't seem to find any information on accessing remote assets via filepath in areas twig can't be used, such as CSS. I'd like to be able to use those same assets in CSS files ...
1
vote
2answers
415 views

Rename a file using onSaveEntry event

craft()->on('entries.saveEntry', function(Event $event) { // entry slug, will be used as image name $EntryTitle = $event->params['entry']['slug']; // Get attached image $entry = ...
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 ...
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 ...
5
votes
1answer
693 views

Uploading Assets w/ Immediate Save?

Heyo - I have an entry form in which you select/upload assets (photos). The asset has a caption/copyright (custom)field attached to it, so ideally I'd tell them… Click "Add Asset" and upload/select ...