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.

eZ debug

Timing: Jan 19 2025 01:00:01
Script start
Timing: Jan 19 2025 01:00:01
Module start 'layout'
Timing: Jan 19 2025 01:00:01
Module start 'content'
Timing: Jan 19 2025 01:00:03
Module end 'content'
Timing: Jan 19 2025 01:00:03
Script end

Main resources:

Total runtime1.6358 sec
Peak memory usage4,096.0000 KB
Database Queries69

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0073 590.2656152.6250
Module start 'layout' 0.00730.0038 742.890639.4453
Module start 'content' 0.01111.6231 782.3359541.9063
Module end 'content' 1.63420.0015 1,324.242216.1719
Script end 1.6357  1,340.4141 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00370.2276160.0002
Check MTime0.00140.0852160.0001
Mysql Total
Database connection0.00130.079010.0013
Mysqli_queries1.520692.9572690.0220
Looping result0.00080.0488670.0000
Template Total1.572296.120.7861
Template load0.00340.209220.0017
Template processing1.568795.901120.7844
Template load and register function0.00020.011010.0002
states
state_id_array0.00170.103710.0017
state_identifier_array0.00090.053820.0004
Override
Cache load0.00330.20031140.0000
Sytem overhead
Fetch class attribute can translate value0.00090.057720.0005
Fetch class attribute name0.01040.635970.0015
XML
Image XML parsing0.00020.013320.0001
class_abstraction
Instantiating content class attribute0.00000.001070.0000
General
dbfile0.00240.1442100.0002
String conversion0.00000.000740.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
7content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
21content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
15content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 45
 Number of unique templates used: 5

Time used to render debug report: 0.0002 secs