Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#111 2021-01-09 16:31:36
- decode
- Member
- From: Italy
- Registered: 2008-02-14
- Posts: 8
Re: soo_image: simple yet powerful image tags
Hi Jeff,
Thanks for your reply! Just for testing purposes, I provide an image context using soo_image_select as container tag on a page selecting a single picture with id. The image, uploaded through the admin UI before, resides in Textpattern’s images folder.
<txp:soo_image_select id="1">
<txp:soo_image />
<txp:soo_exif />
</txp:soo_image_select>
The image is displayed correctly, but no Exif data and the above Tag error remains.
Btw, reading up on how to use Textpattern values in a txp:php
block, I was able to parse the picture’s metadata by invoking exif_read_data()
directly using soo_image_url
(or Txp’s own image_url
) and it works fine (the example code pulls the whole unformatted data-block, oc).
<txp:php>
$exif = exif_read_data(parse('<txp:soo_image_url id="1" />'), 0, true);
foreach ($exif as $key => $section) {
foreach ($section as $name => $val) {
echo "$key.$name: $val<br />\n";
}
}
</txp:php>
Last edited by decode (2021-01-09 16:50:59)
Offline
#112 2021-01-09 17:15:39
- jsoo
- Plugin Author
- From: NC, USA
- Registered: 2004-11-15
- Posts: 1,792
- Website
Re: soo_image: simple yet powerful image tags
OK, I think the issue is that soo_image_url
and soo_exif
don’t use the same code for building the URL. The former uses the Txp constant hu
for the base URL, but the latter uses $_SERVER['DOCUMENT_ROOT']
. Possibly I had a reason for doing so, but I don’t recall.
If you don’t mind, please find the following line:
$img_dir_path = $_SERVER['DOCUMENT_ROOT'] . "/$img_dir/";
and replace it with:
$img_dir_path = hu . $img_dir .'/';
and see if that fixes the issue for you.
Code is topiary
Offline
#113 2021-01-10 18:52:08
- decode
- Member
- From: Italy
- Registered: 2008-02-14
- Posts: 8
Re: soo_image: simple yet powerful image tags
Modifying the $img_dir_path
variable didn’t help, but thanks to your hint, I may have found the underlying problem: I was running Textpattern from a subdirectory. Moving my install to the root folder solved any issues and txp:soo_exif
now returns Exif tags correctly.
Fiddling around with the image path variables I’ve found that $img_dir_path
is never fully formed because $img_dir
doesn’t return anything. Shouldn’t it return the path of Textpattern’s images
folder set in the preferences tab? I think a similar issue has been discussed here. Maybe @bloke can help shed some light on this?
Thanks for your time, Jeff.
Last edited by decode (2021-01-10 18:52:43)
Offline
#114 2021-01-10 19:00:08
- jsoo
- Plugin Author
- From: NC, USA
- Registered: 2004-11-15
- Posts: 1,792
- Website
Re: soo_image: simple yet powerful image tags
decode wrote #328121:
Fiddling around with the image path variables I’ve found that
$img_dir_path
is never fully formed because$img_dir
doesn’t return anything. Shouldn’t it return the path of Textpattern’simages
folder set in the preferences tab?
Yes, that’s the intent, hence hu . $img_dir . '/'
should work even for a subdirectory installation. $img_dir
clearly is returning the correct result, otherwise you would be getting the error again. While fiddling around did you remember to declare global $img_dir;
?
Code is topiary
Offline