Jump to content



Photo
* * * * * 10 votes

Support thread for the Image Magic contribution


  • Please log in to reply
1270 replies to this topic

#1   tomjmul

tomjmul
  • Members
  • 196 posts
  • Real Name:Tom Muldown
  • Location:Ireland

Posted 20 November 2005 - 19:04

This is the support thread for the 'Image Magic' contribution.

Image Magic is a powerful new contribution for OSCommerce designed to greatly improve the way your images are displayed. At the core of its functionality is the ability to produce smoothly rendered thumbnail (smaller) versions of your store's product images. In addition, it also contains a very comprehensive toolbox of 'on-the-fly' image processing functions to both improve your images and also, if you wish, protect them from theft and unauthorized use by your competitors, ebayers and the like.


If you are having difficulties installing or using this contribution, your first port of call should be the readme file contained within the package or available online in its most recent form:
here

Next, you should make sure you have the most up-to-date version of the contribution.

And lastly, read this thread to see if someone else has solved the issue.

If you are still having problems, then feel free to post here.
OSC Image Magic
On-the-fly thumbnails, watermarks and image processing

#2   aarondwyer

aarondwyer
  • Members
  • 31 posts
  • Real Name:Aaron Dwyer
  • Location:Brisbane, Australia

Posted 21 November 2005 - 01:34

Well done Tom.

Just going through it now and integrating it.

Issue with the readme.html in the install with html_output.php, the code is missing a ';' on the $image_size line. Should be this.

if (strtolower(getcwd())."/" != strtolower(DIR_FS_CATALOG)) {
		$image_size = @getimagesize("../..".$src);
		$src=str_replace(DIR_WS_CATALOG_IMAGES,DIR_WS_IMAGES,$src);
  }

Thanks
Aaron
Aaron Dwyer

#3   aarondwyer

aarondwyer
  • Members
  • 31 posts
  • Real Name:Aaron Dwyer
  • Location:Brisbane, Australia

Posted 21 November 2005 - 02:58

Ok I'll be first cab off the rank and raise my hand to be dolt of the day.

Is anyone else unable to get their images to show.?

My product images <img src="blah"> tags are completely missing in the final html, hence no images are showing.

The other images (non-product) are all showing up ok.

I think this could be related to the shop / non shop image selection option (which is a good option to have).

I'm still investigating. Anyone have any ideas for me.

Thanks
Aaron
Aaron Dwyer

#4   aarondwyer

aarondwyer
  • Members
  • 31 posts
  • Real Name:Aaron Dwyer
  • Location:Brisbane, Australia

Posted 21 November 2005 - 03:29

After toggling options for the last half hour, I've worked out that you have to have set in the Images configuration for Image Required = true

This allows the images to be shown, and Image Magic is now doing it's thing.

I don't really want to have this set, since there are several instances of where I don't have an image, and I'd rather not see a failed image holder.

Any ideas?

Thanks
Aaron
Aaron Dwyer

#5   tomjmul

tomjmul
  • Members
  • 196 posts
  • Real Name:Tom Muldown
  • Location:Ireland

Posted 21 November 2005 - 07:47

Hi Aaron,

Thanks for your help. I have fixed the readme.

Regards the images required setting, I have switched mine off and it is still working fine, this is going to take a little more tracking down.

Following the logic of the tep_image() finction, the only time the image required setting comes in to the equation, is when image magic cannot open the file asked for to check its dimensions (should be an indicator of a missing image file). In this case, it checks IMAGE_REQUIRED and if off, returns nothing (as it should). In your case, it would appear that it can't open any of your images and the paths are somehow wrong.

So here is where I'm confused. You say when you switch this on image magic works. Are you sure? Right click one of your images and see does the 'imagemagic.php' script show up in its url.

Tom
OSC Image Magic
On-the-fly thumbnails, watermarks and image processing

#6   tomjmul

tomjmul
  • Members
  • 196 posts
  • Real Name:Tom Muldown
  • Location:Ireland

Posted 21 November 2005 - 08:47

Aaron,

I have now taken out the admin side of this script as there is no need for it in my honest opinion and I can see it will cause a world of trouble (starting with that damn missing semi-colon /smile.gif' class='bbc_emoticon' alt=':)' /> ). The problem is the osC split admin/store way of doing things which I think everyone agrees is a complete nuisance and is to change in ms3.

The way I detect whether the script is running in admin and then alter the path was a hack and I never liked it. The other solution would be to go messing with configuration files and such, but I don't see the point.

For your version:

1. Restore admin/includes/html_output.php to original.
2. In catalog/includes/html_output.php
Change:
// If running in Admin adjust the pathname
  if (strtolower(getcwd())."/" != strtolower(DIR_FS_CATALOG)) {
		$image_size = @getimagesize("../..".$src);
		$src=str_replace(DIR_WS_CATALOG_IMAGES,DIR_WS_IMAGES,$src);
  } 
  else {  
	  $image_size = @getimagesize($src);
  }

To:
$image_size = @getimagesize($src);

This should make everything work with the images required set false.

Let me know how you get on.
OSC Image Magic
On-the-fly thumbnails, watermarks and image processing

#7   aarondwyer

aarondwyer
  • Members
  • 31 posts
  • Real Name:Aaron Dwyer
  • Location:Brisbane, Australia

Posted 21 November 2005 - 10:14

You were correct.

It wasn't using ImageMagic before at all.

The fix you just mentioned now works like a treat, and the ImageMagic is now actually being used.

I can now run with Image Required = false.

Thank you.

I'm one of the ones from On the Fly that could *never* get server caching to work on windows.

It didn't bother me before because I develop on windows and host with linux and it worked on linux.

Now I have a task to get it onto a host running windows and am still not able to server cache.

Does Image Magic store in an 'thumbnails' sub directory for each image directory or in 1 /images/thumbnails folder? I wasn't sure what the readme was referring to. I have several subdirectories since I've categorised my image directory.

My windows system is not writing the thumbnails to the drive at all. At least ImageMagic doesn't die badly when you have server cache turned on unlike On the Fly.

Thanks
Aaron
Aaron Dwyer

#8   tomjmul

tomjmul
  • Members
  • 196 posts
  • Real Name:Tom Muldown
  • Location:Ireland

Posted 21 November 2005 - 17:28

Aaron,
The way caching works is as follows:
Lets say you have a categorized images directory /images/cat1 /images/cat2 images/cat3...etc
Now if you have your cache path set to /thumbnails, as the script starts getting used it will start shadowing your image directory under the thumbnails one. So the first time it is asked to produce a thumbnail from an image contained in /images/cat1 it will create a folder thumbnails/images/cat1 and cache the thumb there. This will eventually result in a complete shadow of all of the directories in your images folder within the cache one.
Regards windows, I will be installing a store on a windows machine within the next week or so. If I come across any major differences I will create a seperate windows version, otherwise I will tweak. I would have thought that it might have managed as it, but there you are.
What happens with caching turned on on windows?
Tom

Edited by tomjmul, 21 November 2005 - 17:29.

OSC Image Magic
On-the-fly thumbnails, watermarks and image processing

#9   mcbsolutions

mcbsolutions
  • Members
  • 173 posts
  • Real Name:Dan
  • Gender:Male

Posted 21 November 2005 - 23:44

hi,
thanks for the contribution. This looks great! I'm not very familiar with Image Magic so bear with me on my newbie question.

I'm working on a site that has product images that are not all the same width and height (although close). Will I have to make them all have at least one dimension the same (height or width) for my images to display with the correct proportions? Or is there a setting in this contribution that will assist with this?

Thanks!


Steve

#10   tomjmul

tomjmul
  • Members
  • 196 posts
  • Real Name:Tom Muldown
  • Location:Ireland

Posted 22 November 2005 - 00:02

I'm working on a site that has product images that are not all the same width and height (although close). Will I have to make them all have at least one dimension the same (height or width) for my images to display with the correct proportions? Or is there a setting in this contribution that will assist with this?


Yes, you just need to set a maximum width OR height (but generally not both). When i/m is passed a width it will work out the height (and vice versa) itself so as to keep the image always in the correct proportions.

If one or more of your images are actually smaller than the dimensions of the thumbnail asked for, you have the 3 options. First, you can set i/m to scale it up. Second, you can have it just display at its native width and height - I.E Over-ride the thumbnail size. And lastly the thumbnail can be produced at the size required, with the source displayed at its size, centered on a white background

The basic idea of i/m is to ensure that your thumbnails are always uniform and in proportion

Edited by tomjmul, 22 November 2005 - 00:06.

OSC Image Magic
On-the-fly thumbnails, watermarks and image processing

#11   azer

azer
  • Members
  • 842 posts
  • Real Name:azer
  • Location:Paris, france

Posted 22 November 2005 - 01:10

your work seems really so perfectionistic good features .. do you think taht you ll handle multiple image for a products liek mopics or other good contrib ?
best regards
MS2

#12   aarondwyer

aarondwyer
  • Members
  • 31 posts
  • Real Name:Aaron Dwyer
  • Location:Brisbane, Australia

Posted 22 November 2005 - 01:17

Hopefully someone else that runs Windows can confirm. But the server side caching isn't creating directories or of course the thumbnails. Time to break out the debug strings to find out what is going on.

Thanks
Aaron
Aaron Dwyer

#13   tomjmul

tomjmul
  • Members
  • 196 posts
  • Real Name:Tom Muldown
  • Location:Ireland

Posted 22 November 2005 - 02:46

your work seems really so perfectionistic good features .. do you think taht you ll handle multiple image for a products liek mopics or other good contrib ?
best regards


Thanks Azer...I did try my best

Regards the extra images, it would be very easy to make this contribution work in conjunction rather than instead of these contribs. I may code this into a future version. I did include functionality for an extra sized product information image - The one on the product details page. I did this because I could swing it so that no other files would need modded as this image is only shown on one page, which I could detect.


Aaron, to save you a bit of poking, stick a few of those echos around the make_dirs() call in modify_tn_path()

Tell me, are you getting the cache creation error message in your images with caching switched on?

Anyone else tried caching on windows?
OSC Image Magic
On-the-fly thumbnails, watermarks and image processing

#14   kaileen

kaileen
  • Members
  • 17 posts
  • Real Name:Kaileen

Posted 22 November 2005 - 06:14

I get this error. The only other contrib I have installed is the SPPC 4.11

Parse error: parse error, unexpected '}' in /home2/sacredc/public_html/test/includes/functions/html_output.php on line 228

If I remove the } I then get an error in the header at line 87 <
Any ideas would be greatly appreciated.
Thanks

#15   2oldnslow

2oldnslow
  • Members
  • 10 posts
  • Real Name:Alien
  • Location:Rachel, Nevada, USA

Posted 22 November 2005 - 06:26

Install file:

Step #4 - Add files
Copy the files contained in the zip archive to their respective directories on your server - Easy eh?


Hello,

I extracted the files and have empty folders at these locations:

admin/includes/imagemagic/fonts and watermarks. Is this correct?
2oldNslow

I am no expert, I am only trying to help.
Always, always back up.Use several browsers like IE,
Opera, Firefox and Netscape to view your work..
The free tools work great to do osCommerce changes,
PHP Designer 05/06, NoteTab Lite, SciTE, PSPad, XAMPP,
Filezilla, 1st Page, osCommerce is #1!

#16   will32

will32
  • Members
  • 82 posts
  • Real Name:will

Posted 22 November 2005 - 13:48

Hi,

I have installed the new version of this comtribution, but the image magic in admin does not seem to work@ eg i have added the 3d frame and nothing happens also the images seem to be the same as before. pls help

thanks

#17   tomjmul

tomjmul
  • Members
  • 196 posts
  • Real Name:Tom Muldown
  • Location:Ireland

Posted 22 November 2005 - 14:02

Parse error: parse error, unexpected '}' in /home2/sacredc/public_html/test/includes/functions/html_output.php on line 228


You might have installed it wrong, restore your backups and try again.

I extracted the files and have empty folders at these locations:


I have removed the admin functionality. Download the latest version on the contribs section of oscommerce.

I have installed the new version of this comtribution, but the image magic in admin does not seem to work@ eg i have added the 3d frame and nothing happens also the images seem to be the same as before. pls help


To see if im is working properly, right click the image, select properties and check to see if imagemagic.php is in the url
OSC Image Magic
On-the-fly thumbnails, watermarks and image processing

#18   aarondwyer

aarondwyer
  • Members
  • 31 posts
  • Real Name:Aaron Dwyer
  • Location:Brisbane, Australia

Posted 22 November 2005 - 20:29

Lots of echo's and 1/2 hour later I have solved the mysterious Windows issues.

You must use the full path. DIR_FS_CATALOG. Adjusted to remove the extra slashes. I can't see why full path wouldn't work under unix as well. We'll soon see.

Tom maybe you can make this code better and work something into your contrib.

in file /catalog/imagemagic.php
in function modify_tn_path($file, $check_cache)

//create the directory tree if not already there
			$create_path=dirname($tn_path. $file);
//added this line for windows
			$create_path = substr(DIR_FS_CATALOG,0,strlen(DIR_FS_CATALOG)-1) . $create_path;

and

//			return $tn_path. $file;
//comment the above line, added this line for windows
			return substr(DIR_FS_CATALOG,0,strlen(DIR_FS_CATALOG)-1) . $tn_path . $file;

Thanks
Aaron

Edited by aarondwyer, 22 November 2005 - 20:30.

Aaron Dwyer

#19   will32

will32
  • Members
  • 82 posts
  • Real Name:will

Posted 22 November 2005 - 20:42

You might have installed it wrong, restore your backups and try again.
I have removed the admin functionality. Download the latest version on the contribs section of oscommerce.
To see if im is working properly, right click the image, select properties and check to see if imagemagic.php is in the url



Hi,
Thanks for getting back.

Ok i have right clicked on the image properties and imagemagic.php is not in the url. my properties show
http://domani name/store/images/bodyring.JPG.

Any help would be great. I followed the install instructions to the t. Which was posted on 21st November 05.

Thanks

#20   timinark

timinark
  • Validating
  • 58 posts
  • Real Name:Tim Oppenheim
  • Location:Arkansas

Posted 22 November 2005 - 21:23

Tom,

I have installed, but not producing images. Image info does point imagemagic.php. I am running Windows server.

Tim