Jump to content

irrelevant.com

Members
  • Content count

    24
  • Joined

  • Last visited

1 Follower

Profile Information

  1. irrelevant.com

    ThumbNails and WaterMarks OnTheFly

    If you view-source on the page as displayed in your browser, are the images referred to as *.jpg or *.thumb ? There are two parts to the mod; the routine to process and display the thumbs, which will kick in for any jpg which is called up with .thumb instead, and the mod to osc which spots that a jpg is bigger than it needs to be, and replaces the file extension with .thumb when it is accessed. The osc mod is in a subroutine in general.php (I think; it's been a while...) so should be called by anything displaying a jpg. It's possible that the additional images mod does not use this subroutine though, and instead displays the <IMG tags directly, I don't know, having not delved into it. If you are still seeing .jpg and not .thumb in the source, then you just need to do a str_replace in that routine along the lines of the mod to general.php as described in the readme.
  2. irrelevant.com

    ThumbNails and WaterMarks OnTheFly

    well, according to http://uk2.php.net/imagejpeg , that puts quality up from the default of 75 to the max of 100, so I would say yes, try it first. As for making the image slightly larger than required... just edit the settings for MAX_WIDTH and MAX_HEIGHT - these would normally match the thumbnail sizes as set in your osc admin - if you make them bigger, then obviously you'll be sending more to the browser, and it'll squash it down a bit (though not as much as it would for the full size image of course!) I havn't played with imagecopyresampled(), but reading the man pages again, yes, it should improve thngs. Just substitute it for imagecopyresized() - the parameter list looks the same. Let me know if you try using it, and how it turns out! Rob.
  3. irrelevant.com

    ThumbNails and WaterMarks OnTheFly

    off the top of my head, try changing $mimage=$QUERY_STRING; to $mimage=rawurldecode($QUERY_STRING); in each script ... this should turn the %20 back into a space. .... in my experience, spaces in filenames, machine names, windows share names, etc. are a major pain in the neck and should be avoided wherever possible. Rob
  4. irrelevant.com

    ThumbNails and WaterMarks OnTheFly

    in image.php, try something like: just before the line //Loading $watermark_img = imagecreatefrompng($wmark); add: $mi_size = getimagesize($mimage); if ($mi_size[1] > 400 ) { // if taller than 400 pixels $wmark='watermark1.png'; // use one image } else { // else $wmark='watermark2.png'; // use another } Obviously you can adjust or add as many tests as you want... I'm still trying to find time to make the other mods people have requested... :=( why are there insufficient hours in the day?
  5. irrelevant.com

    ThumbNails and WaterMarks OnTheFly

    Thanks for the kind words... re broken images ... Firstly, check you can access an image directly: http://www.yoursite.tld/catalog/images/whatever.jpg http://www.yoursite.tld/catalog/images/whatever.thumb If those don't work, try going via the image file http://www.yoursite.tld/image.php?/local/path/to/catalog/images/whatever.jpg http://www.yoursite.tld/thumb.php?/local/path/to/catalog/images/whatever.jpg if the latter ones work, then it's likely a problem with the .htaccess check your logs - some people have had issues with virtual hosting providers whereby the path .htaccess passed to the php routine was not the same path as necessary to access the file. You will have to add in a replace routine at the start of each php to substitute the correct path for the incorrect portion. Check backwards in this thread for details. If all the above http examples work, but acessing images in the catalog doesn't,then it's an issue with the oscommerce function you have amended... double check everything... (This is actually the main benefit of using the .htaccess - however you call up the images, from inside osc, directly, or from some other website (we use ebay!) you still get the ability to use thumbnails and watermarks!) As far as transparency goes, my routines use solid black as the transparency colour - is your design on a black background? I can't help w.r.t. required versions of GD... I use FreeBSD, and the package it's got installed is "php4-gd-4.3.9" which I think is just the php version! All our images tend to be the same size, but the thumbnails are scaled in proportion, so should look ok. I will test it with multiple sizes when I get the next version done, though. I've not looked at the other contrib you mentioned, but will do so. Not had chance to do any morework on mine today, either, I'm afraid. Been bogged down by an internal fileserver playing up... Regards Rob
  6. irrelevant.com

    ThumbNails and WaterMarks OnTheFly

    You really confused me for a while... I wasn't aware that there was a 1.1 or 1.2 version! My contribution is at: http://www.oscommerce.com/community/contributions,1839 which doesn't mention [ brackets or have mussing thumb.php files. (And I just downloaded it to make sure!) Having had a look though, I found this: http://www.oscommerce.com/community/contributions,2431 which is a modification to mine "by ORIENT | September 9, 2004", posted as a seperate contrib. I believe this is the one you are taking about. I've not checked it yet, but will do so in the course of today, and see if I can put together a new version including his additions and some additional features I have thought about here, after having it in use for so long. (and with hopefully a readme you will be happy with :D ) If you are impatient, I'd suggest you download my 1.0 and see if that works for you. It at least will have the "missing" files you are looking for. best wishes, Rob.
  7. irrelevant.com

    ThumbNails and WaterMarks OnTheFly

    Hi Matthew, thanks for the PM, I'm replying here as then it's available for anybody else having trouble too. Firstly, check you can still goto http://your.server/catalog/images/yourimage.jpg (note, JPG) and see the full-size image you are expecting. If not, then probably the rewrite rules are upset, and you are redirecting all jpgs to the thumbnail prog too - check all .htaccess files - any in that directory and in all above it too. If that works, displaying the correct image, then it's the code added to function tep_image() that's messed up. It's designed to replace .jpg with .thumb only if the requested size of the image is thumbnail sized or smaller (and then only if the actual image is bigger). Check the IFs and positioning in that area. regards Rob.
  8. irrelevant.com

    ThumbNails and WaterMarks OnTheFly

    Files ending .thumb do not physically exist ... it's more of a tag thet gets picked up by the .htaccess to redirect the request to thumb.php. Can you access http://yoursite/thumb.php?/local/path/to/image.jpg and does it show a picture? (not this is full path, from root, not a local or relative path) try also http://yoursite/thumb.php?relative/path/to/image.jpg (note the lack of leading / after the ?) Is there anything showing in your error_log ? This might be a case similar to a previous issue in this thread caused by virtual hosting, where the local path to the image as passed to the script by Apache was not the path the script needed to use to access the file. You can get around this by issuing a string replace within the script to substitute the correct path for the path as passed. Rob
  9. irrelevant.com

    ThumbNails and WaterMarks OnTheFly

    The way the code is written at the moment, the watermark image is positioned over the source image top left corner, so if you use various size images, then yes it can appear to move about... If you wish to use a watermark on your thumbnails, which will presumably be all the same size, it'll be easiest to simply move the 'imagecopymerge' line to after the reisize section within images.php - make a small watermark image (same size as a thumbnail) for this and alter it's filename in the code. For putting the watermark in the middle of the picture, you could possibly adjust the position of it based on the height/width of the size images and watermark image... As we take all our own pictures, and keep them pretty much the same size, I never had need for this, however you could use something like $posx = max(0, ($width - $wmk_width) /2) to calculate a position...
  10. irrelevant.com

    ThumbNails and WaterMarks OnTheFly

    Hi Daniel. The .php files can be called anything you like, they are only referred to by the .htaccess file you add to your images folder, so it needs to be in step with that, but that's all. (indeed, probably best you do change the name and make it obscure..) I don't know why the path would be being altered.... it should be passed the full path to the file.. it might be something in your apache config that's rewriting it.... Why did you pick mimage to replace image? Has there been a change of name in the subroutine elsewhere?
  11. irrelevant.com

    ThumbNails and WaterMarks OnTheFly

    Hi Salvo, If all you want is the watermarks, you just need to put the .htaccess in your images_big folder. Make sure that the path to images.php within the .htaccess is correct for wherever you put that file. No mods to osc itself are needed for just this. Shmuel, I really have no idea where the jpeg is coming from... :-( maybe do a grep across the php files see if you can see where it's referred to? Fadel, I was rather hoping the installation notes were simple enough. There is only one code change to osc for to make it use the thumbnails, the rest is standalone php files and a redirect to them in the Apache .htaccess files. If you have any problems with installing this, please do let me know. Rob,
  12. irrelevant.com

    ThumbNails and WaterMarks OnTheFly

    The only other thing I can think about here is that somewhere something else is adding the .jpeg to the .thumb. Where exactly are you seeing this? The <img src snippet you quote doesn't mention .jpeg..
  13. irrelevant.com

    ThumbNails and WaterMarks OnTheFly

    Congrats in finding out the path issue. I've got height/width set in admin as 100/80 to match the thumbnail size, but all my images are sized to that ratio already (just bigger). If you typically use different sizes, or want to calculate them on the fly based on the original image size, you can edit thumb.php accordingly - the sizes are set within there. As for the .thumb.jpeg - are your images all called .jpeg or just .jpg ? html_output.php swaps in .thumb for .jpg, and thumb.php swaps back .jpg for .thumb to find the file - if you are using alternate file extensions you might have problems, and need to create some alternates e.g. (thinking aloud here) if you use both .jpg and .jpeg on your site: add an extra replace in html output to replace .jpeg with (say) .thump copy thumbs.php to thump.php. edit it and change the replace to put back .jpeg for .thump edit the .htaccess and add an extra line to redirect files ending .thump to thump.php that should then use an alternate extension for the .jpeg, and work... In the long run it MIGHT be easier to do something to just add .thumb to the end of the filename, and some more interesting work within thumbs.php to determine original filename, to allow for use of GIFs, PNG, etc. But I wrote this originally for my own use on a site where our product images are exclusively named *.jpg as a quick fix following the theft of some of our pictures and their use on eBay.
  14. irrelevant.com

    ThumbNails and WaterMarks OnTheFly

    That certainly seems to be where the error lies; it can't find the file it's been passed as a parameter. However it's passed it by the .htaccess redirect as the local path to the file you actually requested. Try calling it direct: This will allow you to play with the path name to see what's going on ... it might be that the account your web server runs the php as does not have permissions to traverse the directory structure all the way from / .. you might be able to access it another way, in which case you can adjust the redirect accordingly. Rob
  15. irrelevant.com

    ThumbNails and WaterMarks OnTheFly

    Thank you :-) Can you access a thumbnail directly? i.e. call up http://your.web.site/images/ImageName.thumb ? if this fails, or doesn't display a smaller picture, you've a problem with either the .htaccess or the thumbs.php file - check your error_log to find out which. If it works directly, displaying a thumbnail, then your problem is likely to be the additional code in html_output.php misbehaving. The code I have here is: ? ?if ($image_size = @getimagesize($src)) { ? ? ? ?if (($width < 101 || $height < 81) && ($image_size[0] > 101 && $image_size[1] > 81 )) { ? ? ? ? ? ?$image = str_replace(".jpg",".thumb",$image); ? ? ? ?} ? ?} which is just a quick replace of ".jpg" with ".thumb" if the image size required is as small as a thumbnail and the picture is bigger. if your image already ends jpEg, then obviously this replace won't work, and (presumably) nothing will happen...
×