wider Posted January 21, 2003 Posted January 21, 2003 Good evening!!! I'm trying to code an extension to mo_pics or big_image. I am trying to check for duplicates and delete all subimages associated to a deleted product. As I'm also using a image-resize contribution, I'm having to delete an additional set of subimages with the name: 'imagename-dimensions.jpg' (eg. keyboard-80x100.jpg) I assumed, I might be the easiest to use a wildcard expression to delete the fieles beginning with the full 'filename'. How do I express this wildcard, though? if ($duplicate_image['total'] < 2) { if (file_exists(DIR_FS_CATALOG_IMAGES . $product_image['products_image%'])) { @unlink(DIR_FS_CATALOG_IMAGES . $product_image['products_image%']); } } The '%' didn't help! Do you have any ideas? I would love to listen to you wisdom; criticism and alternative ideas are also appreciated. Thanks! German
badjuju Posted January 21, 2003 Posted January 21, 2003 I'm not sure if escape characters are needed, but you might want to consider using '' before and after the wildcard.
wider Posted January 22, 2003 Author Posted January 22, 2003 Thanks for that answer. Do you have any idea where I'd put the characters? @unlink(DIR_FS_CATALOG_IMAGES . $product_image???['products_image???']); I've been thinking (bad idea): Is it possible at all? $product_image might translate into (e.g.) 'imagename.jpg' if I now add a wildcard to $procuct_image or the field products_image, it will add the wildcard after the file-extension. Am I right? (imagename.jpg*) We wan the wildcard here: 'Imagename*.jpg. Possibly, we'd have to strip the output of the '.*' (the extension part) firs, then add the wildcard and the extension again. Uuuuuh! That's getting spooky! Can you help? Thanks German
Recommended Posts
Archived
This topic is now archived and is closed to further replies.