Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
If anyone has got this working with contemplate please can they put together some documentation on how to do it along with some examples - they would be greatly appreciated! I've been trying to get this working and i can get img scr's printed in the code but don't get any sizes on them at all - so they wont appear on the page.
Cheers
Lucy
Comment | File | Size | Author |
---|---|---|---|
#10 | screenshot_4.gif | 29.45 KB | stanbroughl |
Comments
Comment #1
stanbroughl CreditAttribution: stanbroughl commentedthis is what i get printed in my source code:
for this contemplate coding - with a resize of 300x300 set on it:
Comment #2
stanbroughl CreditAttribution: stanbroughl commentedthis is what i get printed in my source code:
for this contemplate coding - with a resize of 300x300 set on it:
Comment #3
dopry CreditAttribution: dopry commentedtry
foreach ((array)$field_hazard_image_0 as $delta => $item) { ?>
instead of
foreach ((array)$field_hazard_image_0[0] as $item) { ?>
or just remove the [0] after the variable name.
Comment #4
stanbroughl CreditAttribution: stanbroughl commentedi've tried your suggestion but all i'm getting coming up in the source is this, with no images shown:
any other suggestions? they would be greatly appreciated!
Cheers
Lucy
Comment #5
dopry CreditAttribution: dopry commentedCan you give me a print_r() of the field?
Comment #6
stanbroughl CreditAttribution: stanbroughl commentedArray
(
[0] => Array
(
[fid] => 93
[title] => inTERRAgate at the EWC3
[alt] => inTERRAgate at the EWC3
[nid] => 93
[filename] => DSC01011.JPG
[filepath] => files/DSC01011.JPG
[filemime] => image/jpeg
[filesize] => 2336605
[view] =>
)
)
Comment #7
dopry CreditAttribution: dopry commentedand what exactly is in your template currently?
It seems you are not properly referencing/printing the filepath value.
Comment #8
stanbroughl CreditAttribution: stanbroughl commentedthis is what i have in my contemplate template for that image:
image
foreach ((array)$field_hazard_image_0[0] as $item) {
print '<img src="/files/imagecache/hazardimagery/'.$item['filepath']. '">';
}
Comment #9
dopry CreditAttribution: dopry commentedWhat is the output with the solution tendered in comment #3?
Comment #10
stanbroughl CreditAttribution: stanbroughl commentedi get this for the teaser (the image i'm interested in is this part -
):
which doesn't give me an image on the screen - just a tiny dot on each story - regardless of whether they have an image in the field - which i've highlighted on the screenshot
Comment #11
dopry CreditAttribution: dopry commentedIt seems like the path is correct..... You may need to fidget with the .htaccess to make it work... I'm not sure that that is currently documented. I know it is necessary for previews.
comment out everything in the .htaccess file in your files directory and see if it is fixed...
I know there are some issues with that... If that works I'll make it a point to add that to the docs... and Give you an alternative .htaccess file you can use that covers the security points covered by that one.
Comment #12
stanbroughl CreditAttribution: stanbroughl commentedi'm developing the site on my local machine (apache2triad: php 4.4.2 and MySQL 5.0.18) so haven't changed any of the settings from the default .htaccess file yet - what do i need to change here?:
Comment #13
scroogie CreditAttribution: scroogie commentedNo, hes talking about the .htaccess in your file path, per default '/files'. There should be no more than 4 lines in it.
Comment #14
scroogie CreditAttribution: scroogie commentedBy the way, I use imagecache with contemplate and it works flawlessly.
Comment #15
stanbroughl CreditAttribution: stanbroughl commentedok it a go and see what happens - i'm stripping back my site because of some problems i had with my database so hopefully they will fix it.
Can you give me a print out of what should be in that section of the files .htaccess as i'm not sure if i've added the options in the right place now:
SetHandler Drupal_Security_Do_Not_Remove_See_SA_2006_006
Options None
//RewriteEngine off
+FollowSymlinks
Comment #16
scroogie CreditAttribution: scroogie commentedThis is what the .htaccess should look like:
Comment #17
catchI got it working (with scale, nothing with crop unfortunately).
Using this contemplate code:
Which also turns every image into a link to the article.
and this .htaccess in the files directory.
#SetHandler Drupal_Security_Do_Not_Remove_See_SA_2006_006
Options +FollowSymlinks
#
#RewriteEngine on
#
Had to make the imagecache/thumb/files directory structure under my files directory manually.
php4 gd2, image magick.
It looks and works great in firefox.
In internet explorer I have two issues:
1. the thumbnails link to my index page instead of the article.
2. all the articles without images give me broken images.
any help much appreciated fixing those. Good progress though and thanks for all the posts on this issue - been a big help.
Comment #18
scroogie CreditAttribution: scroogie commentedAbout the broken images, I thought the array wouldnt be populated if the field is empty, but if it gets you could do an empty() check like this:
print $item['alt']
" title="print $item['title']
" />}
Comment #19
scroogie CreditAttribution: scroogie commentedSorry, forgot to wrap it in code tags and cannot edit my first comment. Here it is. Memo to self: use preview ;)
Comment #20
catchlovely - working great!
Comment #21
dopry CreditAttribution: dopry commentedI committed some new code to imagecache today. Imagecache should now work with non-default file paths.
I also added a convenient theme_imagecache function that can be called like...
theme('imagecache', $ruleset, $image_path);
This should resolve issues with multisites and any non-default file paths. as well as make it a little easier to work with since you guys won't have to construct the imagecache paths anymore.
I'd appreciate people testing the new code in cvs head.
Comment #22
dopry CreditAttribution: dopry commenteddocs for the new theme function are in the README. plus some details about setting up a ruleset.
Comment #23
stanbroughl CreditAttribution: stanbroughl commentedCheers! sorry for not replying to all these things this week, i've been out in the middle of switzerland with the worst internet connection ever lol!
i'll have a proper investigate later but it all looks good at the moment - thanks for all your help!
Comment #24
(not verified) CreditAttribution: commented