12
votes
Image alignment and size in Redactor 2
No need for a plugin.
Just add:
"imageResizable": true,
"imagePosition": true,
to your chosen redactor config file i.e. (/craft/config/redactor/standard.json)
7
votes
Accepted
Craft 3 image asset getUrl() not showing
The solution is to enable "assets for this source have public URLs" in the volume settings.
5
votes
Accepted
Images containing EXIF orientation tag are not rotated on upload
After some mail exchanges with Brad and Andris from Craft CMS, it turned out that there is an edge case where the image rotation on upload will not work if the EXIF extension is not installed (which ...
4
votes
404 Error showing for Asset Images
Figured it out. I assumed that my assets folder needed 744 just as the install instructions mentioned for the Craft CMS folders. But, I need to change the permissions to the standard 755. Once I did, ...
4
votes
Using Focuspoint with eager loading
After some research I found out that this problem has no simple solution (unfortunately). Check https://github.com/smcyr/Craft-FocusPoint/issues/10.
A solution would be not to use eager loading (...
4
votes
Adding images directly to public folder
You need to use the Update Asset Indexes tool in Settings in the control panel:
Whenever there are files within your asset source that were not added directly by Craft (e.g. via FTP), you will need ...
4
votes
Redactor image caption not saved and formatting lost
I copied your Redactor settings to a clean installation of Craft (2.6.2945) and added an image to a Rich Text field set to use those specific settings. Initially I encountered the same behaviour. ...
4
votes
Accepted
Craft 3 Image quality is terrible after asset upload from admin panel
Converting my comment(s) into an answer...
Make sure you are using the ImageMagick library to handle image manipulation (instead of the default GD library). It provides much better results.
Craft ...
4
votes
How do I add Alt Image Tags to my photos?
Out of the box, you can use the image "Title" as alt text. Since it is already configured - you don't need to add any additional fields. Then you can output this in your twig template as:
{% set ...
3
votes
Assets (images) return a 404 on the front-end
Just had a similar issue with a colleague. Double check your folder permissions. It might be the case that Craft isn’t allowed to write the transformed files to your assets folder.
Something like ...
3
votes
Global Image Variables?
This is a general structure to display global images in any template:
<img src="{{ globalHandle.globalAssetHandle.one().getUrl }}" alt="">
You have to set your global handle ...
3
votes
Load an asset at random each page load
Another way of getting a random image from image set in Craft 3
{{ shuffle(entry.bgImg.all())[0].getUrl('1900x1050') }}
3
votes
403 Forbidden Assets
This article will help you set permissions properly for Craft CMS installs:
Hardening Craft CMS Permissions
It leverages Craft-Scripts to do the heavy lifting.
3
votes
Image Transforms - Image not processed until second page refresh
I'm having this problem too. This can't be expected behaviour, can it?
EDIT (SOLVED):
I've learned from MildlyGeeky in the Craft Discord server that this issue is caused by Twig being picky about ...
3
votes
Accepted
Image transforms not working properly
If I remember correctly, you will see urls similar to this http:\/\/mysite.dev\/cpresources\/404?x=CjvOQxsnA if you have generateTransformsBeforePageLoad as false.
It could genuinely be the case that ...
3
votes
Accepted
How can I insert images into a Redactor rich text field in a front-end form?
It doesn't seems possible natively, you should write a custom upload script.
→ Example #1
→ Example #2
If it doesn't matter to add the images inside your rich text field, one more simple workaround ...
3
votes
Accepted
Default Upload Location needs matrix field and entry info... How?
If your desired URL is:
http://sitename.com/uploads/towns/town-slug/album-name/filename.jpg
The the "Upload Location" for the setup you described would be something like:
towns/{owner.slug}/{...
3
votes
Accepted
Random transforms
You can use Twigs Random function
{{ random(['masonryLarge', 'masonryMedium', 'masonrySmall']) }}
So you could do something like
{% for entry in craft.entries.section('news').limit(10).all() %}
...
3
votes
Accepted
block.image.one() shows more than one image
Yes you're correct, one() will get the first matching element. However, in your code you're not asking for the first image block, but rather the first image from each image block (because each image ...
3
votes
Accepted
Commerce PDF error: Image not found or type unknown
Try setting:
'pdfAllowRemoteImages' => true,
in your commerce.php config file.
3
votes
Accepted
Eager loading on entry not reducing queries
I don't think eager loading will help in this case because you're trying to eager load fields with only a single relationship (asset). It's not the n+1 query problem eager loading is meant to solve.
...
3
votes
How do I add Alt Image Tags to my photos?
An updated answer for 2023: Alternative Text is available to assets as a native field in Craft CMS 4.
To enable it, within Settings > Media: Assets > Volumes > Field Layout, add the "...
3
votes
Accepted
How do you output the Image Caption on an asset?
You should give a try:
{{ craft.assets.filename('refresh1.png').one().imageCaption }}
Where imageCaption is the handle of your Image Caption field (imageCaption is an example, you should check this ...
3
votes
Accepted
'png_compression_level should be an integer from 0 to 9' upon uploading image
This turned out to be a bug and the fix will be in the next release (current version is 3.5.15.1).
3
votes
Generating srcset in a similar way to WordPress
You can write a function, a utility template or a macro to make repetitive tasks like generating responsive images easier. I usually prefer templates, because they're easy to extend and they can take ...
3
votes
Repeated bottle shots on the home page
Ah, the familiar sight of repeating bottles on the homepage. It’s like déjà vu all over again. No need to worry, it sounds like just a “case” of forgotten placeholder code lingering around.
Here’s how ...
2
votes
Matrix field containing asset field blocks entry editing
Well, i found an answer. It seems it was caused by xdebug.
All fields disappearing except 'Title' after saving
Adding this to php.ini helped:
xdebug.max_nesting_level=200
2
votes
Accepted
Using Focuspoint with eager loading
I ran into this issue too and had landed on this thread (and another similar one). I was able to piece together a solution using the modify elements query method. I wrote a pull request that got ...
2
votes
Photo demographic targeting in Craft?
I've used the Craft Geo Plugin for a project previously and it worked really well. It allowed us to serve specific content to detectable regions and areas, so that sounds like what you're after:
...
2
votes
Accepted
Photo demographic targeting in Craft?
If I'm understanding you correctly, this is possible using the standard Craft Pro "locale" stuff. In addition to making text translatable, you can make Assets translatable - in which case you can ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
image × 199assets × 76
image-transforms × 38
templating × 23
upload × 21
craft3 × 15
redactor × 14
richtext × 10
plugin-development × 9
matrix × 8
url × 7
entry × 6
field × 6
entries × 5
error-message × 4
loop × 4
responsive-images × 4
plugin-craftcommerce × 3
plugins × 3
php × 3
error × 3
import × 3
404 × 3
eager-loading × 3
assets-field × 3