Is it possible to pass arguments to an imagecache action preset? I have a 'custom' one I made that i hope to bring in an argument, a field value for a node, called from view. Here's what I have so far working, without any arguments being passed:

<div class="view-field view-data-field_image_fid">
  <?php //print($row->node_data_field_logo_size_field_logo_size_value); // I want to pass this in somehow ?>
  <?php if($row->node_data_field_exhibitor_web_address_field_exhibitor_logo_fid) { 
	$file = field_file_load($row->node_data_field_exhibitor_web_address_field_exhibitor_logo_fid);
	$img = theme('imagecache', 'logo_list', $file['filepath'], $row->node_title, $row->node_title, array('logoSizeString'=>$row->node_data_field_logo_size_field_logo_size_value));
	print $img;
  }; ?>
</div>

Of course, I'm passing in an attribute here, that does not work for what I need.

Thanks for the advise in advance!

CommentFileSizeAuthor
#2 extra_filters.zip2.02 KBowntheweb

Comments

owntheweb’s picture

Title: pass arguments to imagecache preset? » Custom imagecache action module: server out of memory? (works fine in test environment)

Skip that first issue post above. I found a better way to size logos using maxWidth, maxHeight, maxArea, and a white space ratio function. I was able to create an imagecache_actions module that creates a preset called 'Logo Resize'. On my test server, everything works AWESOME! My day started very good today.

However, on my live server I get a blank white screen when I click to add my 'Logo Resize' preset under 'New Actions'. I'm guessing it's a memory issue? To be sure though, do you have a starter set of module files I can play with for an 'extra_filters' module for Drupal 6? That would help me troubleshoot any issues.

Both the live site and test site are nearly identical in versions/files. The online staging area is fresh from my offline test environment.

Any thoughts? Thanks for your feedback.

owntheweb’s picture

StatusFileSize
new2.02 KB

Attached is a shortened version of my code which takes all the arguments, has a full form, but only returns the image. I still have issues with this file on my live server, but not my test server. Also, I can access all the other built-in presets just fine on the live server. Any ideas?

EDIT: Correction: After i clear my cache, go back and choose the preset, I see the form just fine now on the live site. My guess now is that there's something wrong with my code or it's the culprit taking up too much memory. Maybe I'll get this solved myself! Thanks for imagecache_actions, and a spot to write out my issues (the action of writing the issue is helping solve the issue).

dman’s picture

Well I don't see anything wrong with the configuration harness you've posted there - but I don't see the image manipulation code either.

It's easy to blow out the memory on GD if trying to do per-pixel manipulations on large images. Unfortunately, due to alpha-blending issues, there IS one per-pixel algorithm used in the current image overlay step.
To avoid that, you gotta be sure to shrink the image before applying a logo or whatever.

Without the actual processing code, I can't guess what's going wrong for you. All I can say is the hooks look OK though.

I've also seen varying levels of support and accuracy for the gd toolkit on different platforms. At one point (the GD filters) even the function signatures - number of required arguments changed. Were you able to compare the GD version info from your respective phpinfos?

owntheweb’s picture

Status: Active » Closed (fixed)

I'm good to go! I needed to imagedestroy() my temporary resources created. Now it's time to polish, and share the results! It will be my very first module and Drupal contribution. :)

I didn't post the processing code as I thought I was having issues without it and wanted to simplify for support. However it turned out that I just needed to clear my cache to see some changes.

Good thoughts on comparing GD versions. I'll check it out tomorrow.

Now to educate the office about sharing with Drupal community. Thanks for the feedback. Let me know if there are any questions.