zehrila Posted June 11, 2011 Share Posted June 11, 2011 Hi Simon, the strtolower is casuing few issues, some are related to file path of images and actual files and some are relatedt o Meta Titles. I have used strtolower to lowercase my urls, this code is successfully making urls go lowercase, but for some reasons, its also casuing the image pathfile go lowercase, specifically the $cat. I want to keep my lowercase url structure, but i want my image path to be as it is, so that i dont have to go and rename 100s of categories lowercase. Following is the code. <li><a href="<?=$root_domain?>cell-phone-screensavers/<?php echo strtolower($brandname)?>-<?php echo strtolower($phonename)?>-<?php echo strtolower($cat)?>-mobile-screensavers-download-<?=$grow['id']?>.php"> <img style="border: 1px solid #232323" src="hxxp://domain.com/mobilecontents/ss/<?=$seriestitle?>/<?=$cat?>/thumb_<?=$grow['name']?>" alt="" width="100" height="100"></a>Size <?=$img_bytes;?> KB</li> This code, is successfully making urls go lower case, but its also causing the category path for images go lowercase, but in my ftp, the categories are like Adventure with capital A, following is my url, scroll down to spot the error http://bit.ly/msOano Script is trying to pull image file from mobilecontents/ss/240X320/abstract/ but the actual path is mobilecontents/ss/240X320/Abstract How to address this issue? i have renamed directories to lowercase in some sections but in Screensavers and Wallpaper, i have way too many categories to rename to lowercase. You have any words on it? Thanks Quote Link to comment https://forums.phpfreaks.com/topic/239071-strtolower-casuing-directory-path-of-images-to-go-lowercase-help/ Share on other sites More sharing options...
wildteen88 Posted June 11, 2011 Share Posted June 11, 2011 Change strtolower function <?php echo strtolower($cat)?> to the ucwords function <?php echo ucwords($cat)?> Ucwords only capitalises the first letter within the word(s). The rest of the letters will be lowercase. Quote Link to comment https://forums.phpfreaks.com/topic/239071-strtolower-casuing-directory-path-of-images-to-go-lowercase-help/#findComment-1228336 Share on other sites More sharing options...
zehrila Posted June 11, 2011 Author Share Posted June 11, 2011 Wildteen88, thanks, that worked, page is now loading images from directory, but its causing another warning http://bit.ly/msOano . It is supposed to echo image file size, but showing errors there. Is it because its confused between directory path or what? following is the code. <li><a href="<?=$root_domain?>cell-phone-screensavers/<?php echo strtolower($brandname)?>-<?php echo strtolower($phonename)?>-<?php echo strtolower($cat)?>-mobile-screensavers-download-<?=$grow['id']?>.php"> <img style="border: 1px solid #232323" src="http://mobilephones.pk/mobilecontents/ss/<?=$seriestitle?>/<?php echo ucwords($cat)?>/thumb_<?=$grow['name']?>" alt="" width="100" height="100"></a>Size <?=$img_bytes;?> KB</li> <? } }else{ ?> No Screensaver Found For <?=$mobilename?> Quote Link to comment https://forums.phpfreaks.com/topic/239071-strtolower-casuing-directory-path-of-images-to-go-lowercase-help/#findComment-1228345 Share on other sites More sharing options...
wildteen88 Posted June 11, 2011 Share Posted June 11, 2011 Where are your assigning $img_bytes here Size <?=$img_bytes;?> KB</li> Quote Link to comment https://forums.phpfreaks.com/topic/239071-strtolower-casuing-directory-path-of-images-to-go-lowercase-help/#findComment-1228347 Share on other sites More sharing options...
zehrila Posted June 11, 2011 Author Share Posted June 11, 2011 That displays image size under image, it will work perfectly fine if i actually make the category lowercase in ftp and remove echo ucword string, but there are like 200 categories which i will have to lowercase manually. Let me paste the full code. while($grow = mysql_fetch_array($sqlwpslist)){ $image_name = $grow['name']; $filedir = '/home/pspspot/public_html/mobilephones.pk/mobilecontents/ss/'.$seriestitle.'/'.$cat.'/'.$image_name; $img_bytes = ceil(filesize($filedir)/1024); ?> <li><a href="<?=$root_domain?>cell-phone-screensavers/<?php echo strtolower($brandname)?>-<?php echo strtolower($phonename)?>-<?php echo strtolower($cat)?>-mobile-screensavers-download-<?=$grow['id']?>.php"> <img style="border: 1px solid #232323" src="http://mobilephones.pk/mobilecontents/ss/<?=$seriestitle?>/<?php echo ucwords($cat)?>/thumb_<?=$grow['name']?>" alt="" width="100" height="100"></a>Size <?=$img_bytes;?> KB</li> <? } }else{ ?> No Screensaver Found For <?=$mobilename?> Quote Link to comment https://forums.phpfreaks.com/topic/239071-strtolower-casuing-directory-path-of-images-to-go-lowercase-help/#findComment-1228349 Share on other sites More sharing options...
wildteen88 Posted June 11, 2011 Share Posted June 11, 2011 Use ucwords on $cat $filedir = '/home/pspspot/public_html/mobilephones.pk/mobilecontents/ss/'.$seriestitle.'/'.ucwords($cat).'/'.$image_name; Quote Link to comment https://forums.phpfreaks.com/topic/239071-strtolower-casuing-directory-path-of-images-to-go-lowercase-help/#findComment-1228352 Share on other sites More sharing options...
zehrila Posted June 11, 2011 Author Share Posted June 11, 2011 It works like a charm http://bit.ly/msOano , ucwords is working on my meta titles as well, Thanks a lot of stopping by and helping me. I hope you have a really good day ahead Quote Link to comment https://forums.phpfreaks.com/topic/239071-strtolower-casuing-directory-path-of-images-to-go-lowercase-help/#findComment-1228354 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.