Another image problem

Author Message

Mark Overduin

Monday 25 August 2003 1:49:57 am

If I add an image to an article, it is not displayed when I view the article. It isn't even displayed in the admin console. Somehow, somewhere, something goes wrong...

But, when I display the full path to the image, using the following code, I get the original image with its original size. So, uploading works fine, but there might be a problem with the 'thumbnailing'.

- - - code - - -
{$node.data_map.thumbnail.content[original].full_path|ezroot}
- - - - - - - - -

What can it be? I have GD installed correctly. ImageMagick (what is this anyway?) is not installed. I thought I didn't have to install that, because I thought ezP3 uses GD OR ImageMagick.

[edit]
If I edit image.ini and tell ezP3 to use GD instead of 'convert', still nothing is displayed. Not even the images created with 'texttoimage()'. What to do now?
[/edit]

Thanx in advance.

-- Mark

Bjørn Kaarstein

Monday 25 August 2003 2:41:57 am

If you have altered your article class in EZP3.1, you might have this problem, because the admin-layout is handled by specific templates.

{$node.data_map.thumbnail.content[small].full_path|ezroot}
will display a thumbnail. You can set the images sizes for small, medium and large in site.ini

Regards Bjørn

Mark Overduin

Monday 25 August 2003 3:07:50 am

The article class is not modified.

{$node.data_map.thumbnail.content[original].full_path|ezroot}

shows

"var/storage/variations/image/p/h/p"

This is just a path without a filename. I checked and found out that the folder '...../h/p' is empty. I was expecting a thumbnail actually...

Bjørn Kaarstein

Monday 25 August 2003 3:21:30 am

OK, so it seems like your articles isn't stored at all, or do you have the list view in your admin interface? You might want to check that you have the necessary rights (r+w) to the right directories on your installation. Try to run a chmod -R 757 on the necessary directories.(Not very good for security, but OK for testing..)

Also, after publishing your article, manually go in to the directory of yours to check whether the image is there. It usually gets a weird filename.

Regards Bjørn

Mark Overduin

Monday 25 August 2003 3:33:10 am

All the directories of '/var' (including var itself) have 777 permissions.
When I create a new article and add an image to it, the image gets uploaded. Indeed, it has a weird filename (php0nZZRm.jpg).

Just enabled debug. There seems to be a problem with ezImageVariation:

- - - output - - -
Undefined attribute 'contentobject_attribute_id, version, requestedwith, requestedheight', cannot get
Debug: changing value of filename to default
Debug: changing value of width to default
- - - - - - - - - -

The line which contains 'cannot get' ends like that. It's not complete...

Thanks for all the help so far, but the problem is not solved.

I searched the forum for similar problems and there are lots of 'em, but so far I haven't found a thread with a solution (that fits my needs).

-- Mark

Bjørn Kaarstein

Monday 25 August 2003 4:06:52 am

If you go to the url - /content/view/full/66

(where 66 is the node_id of your article - found in the admin interface).

Try {$node|attribute(show)}, and you'll get a bunch of information, hopefully leading you closer to your goal.

If you're looping articles in a section, you can also write
{$:item|attribute(show)}

Also, if you alter you .ini files, rememeber that you'll have to clear the .ini cache.

Hope this helps.

Regards Bjørn

Mark Overduin

Wednesday 27 August 2003 4:27:22 am

Well, that didn't do the trick either...

I had to use images right away, so I programmed something. It's really simple. All the function does, is change the width/height of the image.
At first, I wanted to create real thumbnails (a new image: a copy of the original image, only smaller)

This is my code:
- - - code - - -
"/design/mydesign/override/template/line_article.tpl" (or just 'article.tpl'):
{$node.data_map.thumbnail.content[original].full_path|img_original}
or
{$node.data_map.thumbnail.content[original].full_path|img_thumbnail}

"/kernel/common/eztemplateautoload.php":
include ("marksPHPfunctions.inc.php");
$eZTemplateOperatorArray[] = array('class_parameter' => array('img_thumbnail' => 'img_thumbnail', 'img_original' => 'img_original'),
'operator_names' => array ('img_thumbnail', 'img_original'));

"/kernel/common/marksPHPfunctions.inc.php":
function resizeImage ($path2img, $newWidth, $newHeight)
{
$tmp = getimagesize ($path2img);
$width = $tmp[0];
$height = $tmp[1];
unset ($tmp);

if ($width >= $height)
{
if ($width > $newWidth)
{
$tmp = $width / $newWidth;
$width = $width / $tmp;
$height = $height / $tmp;
unset ($tmp);
}
}
if ($height > $newHeight)
{
$tmp = $height / $newHeight;
$height = $height / $tmp;
$width = $width / $tmp;
unset ($tmp);
}
$result = "<img src=\"/$path2img\" width=\"$width\" height=\"$height\" border=\"1\" align=\"right\">";
return ($result);
}

function img_thumbnail ($path2img)
{
$result = resizeImage ($path2img, 100, 75);
return ($result);
}

function img_original ($path2img)
{
$result = resizeImage ($path2img, 200, 150);
return ($result);
}

function getFilename ($path2img)
{
$filename = explode ("/", $path2img);
$filenameSize = sizeof ($filename);
$filename = $filename[$filenameSize-1];
return ($filename);
}
- - - - - - - - -

Maybe someone can use this also...

I know this is a lousy solution, but I had to use images, so... Plz don't mind the bad coding, I made in what, 40 minutes?
I'll get rid of it, as soon as the ezP3-way works.

-- Mark

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.