You are not logged in.
Pages: 1
Hello,
I've been trying to use cropped images on my website for a slider on the homepage. But when I want to display an image, everything is black. I also can't see a crop preview when I upload a file, but when I hit "upload" I don't have any errors or something... And there is a (black) image file uploaded in the right directory .
Do you guys know what I did wrong?
Offline
I've noticed this happening recently as well -- in the cases I've seen there was a directory permissions issue with where the image would be uploaded. I'd check Developer -> Site Status to see if any errors about permissions are raised.
It's in the bug list to check on why it's not properly throwing an error when uploading.
Offline
Hello,
Thanks for the quick response! When I look in Developer -> Site Status I don't see any errors. Only a warning from the favicon.
Do I need to make extra fields in the module table for cropped images? I don't see a link to a cropped image in the database table either. What does "preview prefix (for forms)" do by the way? do I need to set something there? And does it matter what I set?
Thank you in advance.
Offline
You shouldn't need extra fields for cropping images -- only the primary image name is served in the database. All the additional crops / thumbnails you generally give prefixes to (i.e. large_). If you give your crop a prefix you reference it using the BigTree::prefixFile method. For example:
<img src="<?=BigTree::prefixFile($item["image"],"large_")?>" alt="">
The "Preview Prefix (for forms)" allows you to enter one of the prefixes you're using so that when you edit things in the CMS it loads one of the smaller thumbnails or crops instead of the original image -- this helps a lot if your source images are huge so that you don't slow down editors by loading the giant image. You don't need to put anything there if you don't want to.
Offline
Allright, thanks! I've used the method you mentioned but it's still not working. I am displaying content from a module by the way. Maybe that makes a difference?
This is what I have:
<ul class="bxslider">
<?
$homeSlider = new HomeSlider();
$sliders = $homeSlider->getApproved(3);
foreach ($sliders as $slideItem) {
$image = $slideItem['slide_image'];
$thumb_image = BigTree::prefixFile($image, "thumbslide_");
?>
<li>
<div class="wrapper">
<img src="<?=$thumb_image?>">
<div class="slideDescription">
<span class="redSpan"><?=$slideItem['slide_heading']?> |</span>
<span class="graySpan"><?=$slideItem['slide_subheading']?></span>
<p><?=$slideItem['slide_description']?></p>
<a href="<?=$slideItem['slide_link']?>" alt=""><?=$slideItem['button_text']?></a>
</div>
</div>
</li>
<?}
?>
</ul>
Offline
Does the image it's looking for exist on the file system? All the code above looks good to me.
Offline
Just thought of something else -- are you by chance using a Windows server for hosting? Windows/PHP often don't properly report file system permissions so if you are on Windows you may have a permissions issue with writing to the directory that BigTree can't see.
Offline
Thanks for thinking with me! I have found the problem. In the module there was set a varchar (255) for the upload field. I think the file names were too long becouse of the prefix. I changed it to text and after that everything was working perfectly
It think varchar (255) is the default setting for upload fields. Maybe it's good to consider an extended limit on the default upload field in module builder, becouse pictures taken with a phone usually have long file names with a date and that kind of stuff. (If it's not the default setting: I've said nothing )
Offline
That's good to know! It probably is the case that the Module Designer sets fields to varchar(255) when creating them.
Out of curiosity, what was the filename that was trying to be stored that ended up so long?
Offline
One of the longest was: "smallpicture_img_20150911_142804-2.jpg"
Hmm, not that long actually.. hehe
So the limit wasn't the issue I think...
I'm also curious about what's wrong with a varchar. It should be working fine I think.
Offline
Pages: 1